Source-Changes-HG archive

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

[src/trunk]: src/sbin/ifconfig cast u_char for ctype (nwid stuff) to fix poss...



details:   https://anonhg.NetBSD.org/src/rev/32cfc901bc49
branches:  trunk
changeset: 494415:32cfc901bc49
user:      onoe <onoe%NetBSD.org@localhost>
date:      Thu Jul 06 08:20:51 2000 +0000

description:
cast u_char for ctype (nwid stuff) to fix possible overrun problems.

diffstat:

 sbin/ifconfig/ifconfig.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (31 lines):

diff -r d935815ec7fe -r 32cfc901bc49 sbin/ifconfig/ifconfig.c
--- a/sbin/ifconfig/ifconfig.c  Thu Jul 06 07:26:48 2000 +0000
+++ b/sbin/ifconfig/ifconfig.c  Thu Jul 06 08:20:51 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ifconfig.c,v 1.83 2000/07/06 00:50:49 onoe Exp $       */
+/*     $NetBSD: ifconfig.c,v 1.84 2000/07/06 08:20:51 onoe Exp $       */
 
 /*-
  * Copyright (c) 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -80,7 +80,7 @@
 #if 0
 static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94";
 #else
-__RCSID("$NetBSD: ifconfig.c,v 1.83 2000/07/06 00:50:49 onoe Exp $");
+__RCSID("$NetBSD: ifconfig.c,v 1.84 2000/07/06 08:20:51 onoe Exp $");
 #endif
 #endif /* not lint */
 
@@ -1101,9 +1101,10 @@
        if (val[0] == '0' && (val[1] == 'x' || val[1] == 'X')) {
                val += 2;
                p = nwid.i_nwid;
-               while (isxdigit(val[0]) && isxdigit(val[1])) {
+               while (isxdigit((u_char)val[0]) && isxdigit((u_char)val[1])) {
 #define        tohex(x)        (isdigit(x) ? (x) - '0' : tolower(x) - 'a' + 10)
-                       *p++ = (tohex(val[0]) << 4) | tohex(val[1]);
+                       *p++ = (tohex((u_char)val[0]) << 4) |
+                           tohex((u_char)val[1]);
 #undef tohex
                        val += 2;
                }



Home | Main Index | Thread Index | Old Index