Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/cddl/osnet/dist Fix some snprintf
details: https://anonhg.NetBSD.org/src/rev/a122ceca1231
branches: trunk
changeset: 328146:a122ceca1231
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Fri Mar 28 02:58:36 2014 +0000
description:
Fix some snprintf
diffstat:
external/cddl/osnet/dist/cmd/dtrace/dtrace.c | 2 +-
external/cddl/osnet/dist/cmd/zdb/zdb.c | 3 ++-
external/cddl/osnet/dist/cmd/ztest/ztest.c | 2 +-
external/cddl/osnet/dist/lib/libdtrace/common/dt_link.c | 2 +-
4 files changed, 5 insertions(+), 4 deletions(-)
diffs (56 lines):
diff -r 61f2edfc65b1 -r a122ceca1231 external/cddl/osnet/dist/cmd/dtrace/dtrace.c
--- a/external/cddl/osnet/dist/cmd/dtrace/dtrace.c Fri Mar 28 02:50:18 2014 +0000
+++ b/external/cddl/osnet/dist/cmd/dtrace/dtrace.c Fri Mar 28 02:58:36 2014 +0000
@@ -953,7 +953,7 @@
uint8_t *data;
int lim = rec->dtrd_size;
- (void) snprintf(buf, end, "%d (data: ", rec->dtrd_offset);
+ (void) snprintf(buf, end - buf, "%d (data: ", rec->dtrd_offset);
c = buf + strlen(buf);
if (lim > sizeof (uint64_t))
diff -r 61f2edfc65b1 -r a122ceca1231 external/cddl/osnet/dist/cmd/zdb/zdb.c
--- a/external/cddl/osnet/dist/cmd/zdb/zdb.c Fri Mar 28 02:50:18 2014 +0000
+++ b/external/cddl/osnet/dist/cmd/zdb/zdb.c Fri Mar 28 02:58:36 2014 +0000
@@ -1305,7 +1305,7 @@
nicenum(doi.doi_max_offset, lsize, sizeof(lsize));
nicenum(doi.doi_physical_blocks_512 << 9, asize, sizeof(asize));
nicenum(doi.doi_bonus_size, bonus_size, sizeof(bonus_size));
- (void) snprintf(fill, "%6.2f", 100.0 * doi.doi_fill_count *
+ (void) snprintf(fill, sizeof(fill), "%6.2f", 100.0 * doi.doi_fill_count *
doi.doi_data_block_size / (object == 0 ? DNODES_PER_BLOCK : 1) /
doi.doi_max_offset);
@@ -1423,6 +1423,7 @@
nicenum(refdbytes, numbuf, sizeof(numbuf));
if (verbosity >= 4) {
+ size_t blklen = sizeof(blkbuf);
len = snprintf(blkbuf, blklen, ", rootbp ");
if (len > blklen)
len = blklen;
diff -r 61f2edfc65b1 -r a122ceca1231 external/cddl/osnet/dist/cmd/ztest/ztest.c
--- a/external/cddl/osnet/dist/cmd/ztest/ztest.c Fri Mar 28 02:50:18 2014 +0000
+++ b/external/cddl/osnet/dist/cmd/ztest/ztest.c Fri Mar 28 02:58:36 2014 +0000
@@ -2239,7 +2239,7 @@
for (;;) {
char path[MAXPATHLEN];
int c;
- (void) snprintf(path, sizeof(pathbuf), ztest_aux_template, zopt_dir,
+ (void) snprintf(path, sizeof(path), ztest_aux_template, zopt_dir,
zopt_pool, aux, zs->zs_vdev_aux);
for (c = 0; c < sav->sav_count; c++)
if (strcmp(sav->sav_vdevs[c]->vdev_path,
diff -r 61f2edfc65b1 -r a122ceca1231 external/cddl/osnet/dist/lib/libdtrace/common/dt_link.c
--- a/external/cddl/osnet/dist/lib/libdtrace/common/dt_link.c Fri Mar 28 02:50:18 2014 +0000
+++ b/external/cddl/osnet/dist/lib/libdtrace/common/dt_link.c Fri Mar 28 02:58:36 2014 +0000
@@ -1497,7 +1497,7 @@
r = (char *)data_str->d_buf + istr;
istr += 1 + snprintf(r, data_str->d_size -
- (istr - (char *)data_str->d_buf), dt_symfmt,
+ (istr - (size_t)data_str->d_buf), dt_symfmt,
dt_symprefix, objkey, s);
isym++;
assert(isym <= nsym);
Home |
Main Index |
Thread Index |
Old Index