Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-6]: src/sbin/iscsictl Pull up revisions:



details:   https://anonhg.NetBSD.org/src/rev/aebfc7af5d7e
branches:  netbsd-6
changeset: 774275:aebfc7af5d7e
user:      jdc <jdc%NetBSD.org@localhost>
date:      Mon Jul 02 18:50:11 2012 +0000

description:
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

diffstat:

 sbin/iscsictl/iscsic_driverif.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r 8e41d12211dd -r aebfc7af5d7e sbin/iscsictl/iscsic_driverif.c
--- a/sbin/iscsictl/iscsic_driverif.c   Mon Jul 02 18:01:16 2012 +0000
+++ b/sbin/iscsictl/iscsic_driverif.c   Mon Jul 02 18:50:11 2012 +0000
@@ -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 @@
                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;
        }



Home | Main Index | Thread Index | Old Index