Source-Changes-HG archive

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

[src/trunk]: src/sbin/ifconfig warn instead of print 802.11 nwid with bad len...



details:   https://anonhg.NetBSD.org/src/rev/dda99d48f8f7
branches:  trunk
changeset: 494366:dda99d48f8f7
user:      onoe <onoe%NetBSD.org@localhost>
date:      Thu Jul 06 00:50:49 2000 +0000

description:
warn instead of print 802.11 nwid with bad length field.

diffstat:

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

diffs (39 lines):

diff -r 22f5420b7789 -r dda99d48f8f7 sbin/ifconfig/ifconfig.c
--- a/sbin/ifconfig/ifconfig.c  Thu Jul 06 00:48:53 2000 +0000
+++ b/sbin/ifconfig/ifconfig.c  Thu Jul 06 00:50:49 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ifconfig.c,v 1.82 2000/07/05 02:35:55 onoe Exp $       */
+/*     $NetBSD: ifconfig.c,v 1.83 2000/07/06 00:50:49 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.82 2000/07/05 02:35:55 onoe Exp $");
+__RCSID("$NetBSD: ifconfig.c,v 1.83 2000/07/06 00:50:49 onoe Exp $");
 #endif
 #endif /* not lint */
 
@@ -1108,8 +1108,7 @@
                        val += 2;
                }
                if (*val != '\0') {
-                       errno = EINVAL;
-                       warn("SIOCS80211NWID");
+                       warnx("SIOCS80211NWID: Bad hexdecimal digits.");
                        return;
                }
                nwid.i_len = p - nwid.i_nwid;
@@ -1134,6 +1133,10 @@
        (void)strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
        if (ioctl(s, SIOCG80211NWID, (caddr_t)&ifr) != 0)
                return;
+       if (nwid.i_len > IEEE80211_NWID_LEN) {
+               warnx("SIOCS80211NWID: wrong length of nwid (%d)", nwid.i_len);
+               return;
+       }
        i = 0;
        if (nwid.i_nwid[0] != '0' || tolower(nwid.i_nwid[1]) != 'x') {
                for (; i < nwid.i_len; i++) {



Home | Main Index | Thread Index | Old Index