Module Name:    src
Committed By:   martin
Date:           Wed Jun 20 08:11:12 UTC 2012

Modified Files:
        src/sbin/iscsictl: iscsic_driverif.c

Log Message:
Avoid printing values past the end of the buffer, and a size_t underflow.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 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.3
--- src/sbin/iscsictl/iscsic_driverif.c:1.2	Sun Oct 30 18:40:06 2011
+++ src/sbin/iscsictl/iscsic_driverif.c	Wed Jun 20 08:11: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.3 2012/06/20 08:11:11 martin Exp $	*/
 
 /*-
  * Copyright (c) 2005,2006,2011 The NetBSD Foundation, Inc.
@@ -305,9 +305,13 @@ dump_data(const char *title, const void 
 		}
 		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;
 	}

Reply via email to