Module Name: src
Committed By: jdc
Date: Mon Jul 2 18:50:11 UTC 2012
Modified Files:
src/sbin/iscsictl [netbsd-6]: iscsic_driverif.c
Log Message:
Pull up revisions:
src/sbin/iscsictl/iscsic_driverif.c revisions 1.3,1.4
(requested by martin in ticket #363).
Avoid printing values past the end of the buffer, and a size_t underflow.
Fix previous
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.4.1 src/sbin/iscsictl/iscsic_driverif.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/iscsictl/iscsic_driverif.c
diff -u src/sbin/iscsictl/iscsic_driverif.c:1.2 src/sbin/iscsictl/iscsic_driverif.c:1.2.4.1
--- src/sbin/iscsictl/iscsic_driverif.c:1.2 Sun Oct 30 18:40:06 2011
+++ src/sbin/iscsictl/iscsic_driverif.c Mon Jul 2 18:50:11 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: iscsic_driverif.c,v 1.2 2011/10/30 18:40:06 christos Exp $ */
+/* $NetBSD: iscsic_driverif.c,v 1.2.4.1 2012/07/02 18:50:11 jdc Exp $ */
/*-
* Copyright (c) 2005,2006,2011 The NetBSD Foundation, Inc.
@@ -298,16 +298,23 @@ dump_data(const char *title, const void
printf(" ");
for (i = 0; i < nelem; i++) {
- printf("%02x ", bp[i]);
+ if (i >= len)
+ printf(" ");
+ else
+ printf("%02x ", bp[i]);
}
for (i = nelem; i < 16; i++) {
printf(" ");
}
printf(" '");
for (i = 0; i < nelem; i++) {
+ if (i >= len)
+ break;
printf("%c", isprint(bp[i]) ? bp[i] : ' ');
}
printf("'\n");
+ if (len < 16)
+ break;
len -= 16;
bp += 16;
}