Module Name:    src
Committed By:   ozaki-r
Date:           Fri Mar 28 02:58:36 UTC 2014

Modified Files:
        src/external/cddl/osnet/dist/cmd/dtrace: dtrace.c
        src/external/cddl/osnet/dist/cmd/zdb: zdb.c
        src/external/cddl/osnet/dist/cmd/ztest: ztest.c
        src/external/cddl/osnet/dist/lib/libdtrace/common: dt_link.c

Log Message:
Fix some snprintf


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c
cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/dist/cmd/zdb/zdb.c
cvs rdiff -u -r1.6 -r1.7 src/external/cddl/osnet/dist/cmd/ztest/ztest.c
cvs rdiff -u -r1.5 -r1.6 \
    src/external/cddl/osnet/dist/lib/libdtrace/common/dt_link.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c
diff -u src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c:1.3 src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c:1.4
--- src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c:1.3	Thu Mar 27 15:50:48 2014
+++ src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c	Fri Mar 28 02:58:36 2014
@@ -953,7 +953,7 @@ bufhandler(const dtrace_bufdata_t *bufda
 			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))

Index: src/external/cddl/osnet/dist/cmd/zdb/zdb.c
diff -u src/external/cddl/osnet/dist/cmd/zdb/zdb.c:1.3 src/external/cddl/osnet/dist/cmd/zdb/zdb.c:1.4
--- src/external/cddl/osnet/dist/cmd/zdb/zdb.c:1.3	Fri Mar 28 02:50:18 2014
+++ src/external/cddl/osnet/dist/cmd/zdb/zdb.c	Fri Mar 28 02:58:36 2014
@@ -1305,7 +1305,7 @@ dump_object(objset_t *os, uint64_t objec
 	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 @@ dump_dir(objset_t *os)
 	nicenum(refdbytes, numbuf, sizeof(numbuf));
 
 	if (verbosity >= 4) {
+		size_t blklen = sizeof(blkbuf);
 		len = snprintf(blkbuf, blklen, ", rootbp ");
 		if (len > blklen)
 			len = blklen;

Index: src/external/cddl/osnet/dist/cmd/ztest/ztest.c
diff -u src/external/cddl/osnet/dist/cmd/ztest/ztest.c:1.6 src/external/cddl/osnet/dist/cmd/ztest/ztest.c:1.7
--- src/external/cddl/osnet/dist/cmd/ztest/ztest.c:1.6	Fri Mar 28 02:50:18 2014
+++ src/external/cddl/osnet/dist/cmd/ztest/ztest.c	Fri Mar 28 02:58:36 2014
@@ -2239,7 +2239,7 @@ ztest_vdev_aux_add_remove(ztest_ds_t *zd
 		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,

Index: src/external/cddl/osnet/dist/lib/libdtrace/common/dt_link.c
diff -u src/external/cddl/osnet/dist/lib/libdtrace/common/dt_link.c:1.5 src/external/cddl/osnet/dist/lib/libdtrace/common/dt_link.c:1.6
--- src/external/cddl/osnet/dist/lib/libdtrace/common/dt_link.c:1.5	Thu Mar 27 15:50:48 2014
+++ src/external/cddl/osnet/dist/lib/libdtrace/common/dt_link.c	Fri Mar 28 02:58:36 2014
@@ -1497,7 +1497,7 @@ process_obj(dtrace_hdl_t *dtp, const cha
 
 				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);

Reply via email to