Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/wiconfig don't traverse NULL pointer on "wiconfig -...



details:   https://anonhg.NetBSD.org/src/rev/c10c3966b77e
branches:  trunk
changeset: 484118:c10c3966b77e
user:      itojun <itojun%NetBSD.org@localhost>
date:      Sun Mar 26 08:58:11 2000 +0000

description:
don't traverse NULL pointer on "wiconfig -p 1".
From: veego

diffstat:

 usr.sbin/wiconfig/wiconfig.c |  17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diffs (70 lines):

diff -r 695ee06b2d97 -r c10c3966b77e usr.sbin/wiconfig/wiconfig.c
--- a/usr.sbin/wiconfig/wiconfig.c      Sun Mar 26 08:34:20 2000 +0000
+++ b/usr.sbin/wiconfig/wiconfig.c      Sun Mar 26 08:58:11 2000 +0000
@@ -29,7 +29,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGE.
  *
- *     $Id: wiconfig.c,v 1.2 2000/02/04 07:59:45 explorer Exp $
+ *     $Id: wiconfig.c,v 1.3 2000/03/26 08:58:11 itojun Exp $
  */
 
 #include <sys/types.h>
@@ -67,7 +67,7 @@
 static const char copyright[] = "@(#) Copyright (c) 1997, 1998, 1999\
        Bill Paul. All rights reserved.";
 static const char rcsid[] =
-       "@(#) $Id: wiconfig.c,v 1.2 2000/02/04 07:59:45 explorer Exp $";
+       "@(#) $Id: wiconfig.c,v 1.3 2000/03/26 08:58:11 itojun Exp $";
 #endif
 
 static void wi_getval          __P((char *, struct wi_req *));
@@ -225,6 +225,9 @@
 {
        struct wi_req           wreq;
 
+       if (iface == NULL)
+               errx(1, "must specify interface name");
+
        bzero((char *)&wreq, sizeof(wreq));
 
        wreq.wi_type = code;
@@ -243,6 +246,8 @@
 {
        struct ether_addr       *addr;
 
+       if (iface == NULL)
+               errx(1, "must specify interface name");
        if (str == NULL)
                errx(1, "must specify address");
 
@@ -490,7 +495,7 @@
 
                wi_getval(iface, &wreq);
                printf("%s", w[i].wi_str);
-               switch(w[i].wi_type) {
+               switch (w[i].wi_type) {
                case WI_STRING:
                        wi_printstr(&wreq);
                        break;
@@ -519,7 +524,7 @@
 
                        wi_getval(iface, &wreq);
                        printf("%s", w[i].wi_str);
-                       switch(w[i].wi_type) {
+                       switch (w[i].wi_type) {
                        case WI_STRING:
                                wi_printstr(&wreq);
                                break;
@@ -637,9 +642,9 @@
                argc--;
        }
 
-       while((ch = getopt(argc, argv,
+       while ((ch = getopt(argc, argv,
            "hoc:d:f:p:r:q:t:n:s:i:m:P:S:T:e:k:v:")) != -1) {
-               switch(ch) {
+               switch (ch) {
                case 'o':
                        wi_dumpstats(iface);
                        exit(0);



Home | Main Index | Thread Index | Old Index