Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/wiconfig strcpy audit (command line argument was us...



details:   https://anonhg.NetBSD.org/src/rev/cc14cce66e75
branches:  trunk
changeset: 547196:cc14cce66e75
user:      itojun <itojun%NetBSD.org@localhost>
date:      Thu May 15 00:02:25 2003 +0000

description:
strcpy audit (command line argument was used as src, subject to overrun)

diffstat:

 usr.sbin/wiconfig/wiconfig.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (45 lines):

diff -r e2d4ca608c2a -r cc14cce66e75 usr.sbin/wiconfig/wiconfig.c
--- a/usr.sbin/wiconfig/wiconfig.c      Wed May 14 23:58:23 2003 +0000
+++ b/usr.sbin/wiconfig/wiconfig.c      Thu May 15 00:02:25 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wiconfig.c,v 1.29 2003/04/03 17:26:33 perry Exp $      */
+/*     $NetBSD: wiconfig.c,v 1.30 2003/05/15 00:02:25 itojun Exp $     */
 /*
  * Copyright (c) 1997, 1998, 1999
  *     Bill Paul <wpaul%ctr.columbia.edu@localhost>.  All rights reserved.
@@ -69,7 +69,7 @@
 __COPYRIGHT(
 "@(#) Copyright (c) 1997, 1998, 1999\
        Bill Paul. All rights reserved.");
-__RCSID("$NetBSD: wiconfig.c,v 1.29 2003/04/03 17:26:33 perry Exp $");
+__RCSID("$NetBSD: wiconfig.c,v 1.30 2003/05/15 00:02:25 itojun Exp $");
 #endif
 
 struct wi_table {
@@ -196,7 +196,7 @@
         * the ioctl fails
         */
        memset((char *)&ifr, 0, sizeof(ifr));
-        strcpy(ifr.ifr_name, iface);
+        strncpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name));
         ifr.ifr_data = (caddr_t)&wreq;
 
        printf("scanning ...");
@@ -293,7 +293,7 @@
 
        bzero((char *)&ifr, sizeof(ifr));
 
-       strcpy(ifr.ifr_name, iface);
+       strncpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name));
        ifr.ifr_data = (caddr_t)wreq;
 
        s = socket(AF_INET, SOCK_DGRAM, 0);
@@ -318,7 +318,7 @@
 
        bzero((char *)&ifr, sizeof(ifr));
 
-       strcpy(ifr.ifr_name, iface);
+       strncpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name));
        ifr.ifr_data = (caddr_t)wreq;
 
        s = socket(AF_INET, SOCK_DGRAM, 0);



Home | Main Index | Thread Index | Old Index