PERFORCE change 148161 for review

Hans Petter Selasky hselasky at FreeBSD.org
Sat Aug 23 09:55:45 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=148161

Change 148161 by hselasky at hselasky_laptop001 on 2008/08/23 09:55:03

	
	Use snprintf instead of sprintf.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb2/storage/ustorage2_fs.c#7 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb2/storage/ustorage2_fs.c#7 (text+ko) ====

@@ -983,7 +983,11 @@
 	buf[4] = 31;
 	/* Additional length */
 	/* No special options */
-	sprintf(buf + 8, "%-8s%-16s%04x", vendor_id, product_id,
+	/*
+	 * NOTE: We are writing an extra zero here, that is not
+	 * transferred to the peer:
+	 */
+	snprintf(buf + 8, 28 + 1, "%-8s%-16s%04x", vendor_id, product_id,
 	    USTORAGE_FS_RELEASE);
 	return (ustorage_fs_min_len(sc, 36, 0 - 1));
 }


More information about the p4-projects mailing list