Source-Changes-HG archive

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

[src/netbsd-3-0]: src/sys/net Pull up following revision(s) (requested by chr...



details:   https://anonhg.NetBSD.org/src/rev/f6c72d7ded41
branches:  netbsd-3-0
changeset: 579328:f6c72d7ded41
user:      ghen <ghen%NetBSD.org@localhost>
date:      Thu Oct 26 10:52:57 2006 +0000

description:
Pull up following revision(s) (requested by christos in ticket #1563):
        sys/net/if.c: revision 1.172
        sys/net/if.c: revision 1.173
use strlcpy instead of strncpy or bcopy to copy the interface name.
fix typo.

diffstat:

 sys/net/if.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (40 lines):

diff -r 3aa4f6f0a9d3 -r f6c72d7ded41 sys/net/if.c
--- a/sys/net/if.c      Thu Oct 26 10:51:14 2006 +0000
+++ b/sys/net/if.c      Thu Oct 26 10:52:57 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.154.2.1 2005/08/15 19:04:56 tron Exp $        */
+/*     $NetBSD: if.c,v 1.154.2.1.2.1 2006/10/26 10:52:57 ghen Exp $    */
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.154.2.1 2005/08/15 19:04:56 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.154.2.1.2.1 2006/10/26 10:52:57 ghen Exp $");
 
 #include "opt_inet.h"
 
@@ -933,9 +933,8 @@
 
        for (ifc = LIST_FIRST(&if_cloners); ifc != NULL && count != 0;
             ifc = LIST_NEXT(ifc, ifc_list), count--, dst += IFNAMSIZ) {
-               strncpy(outbuf, ifc->ifc_name, IFNAMSIZ);
-               outbuf[IFNAMSIZ - 1] = '\0';    /* sanity */
-               error = copyout(outbuf, dst, IFNAMSIZ);
+               (void)strlcpy(outbuf, ifc->ifc_name, sizeof(outbuf));
+               error = copyout(outbuf, dst, sizeof(outbuf));
                if (error)
                        break;
        }
@@ -1693,7 +1692,8 @@
                sign = 1;
        }
        IFNET_FOREACH(ifp) {
-               bcopy(ifp->if_xname, ifr.ifr_name, IFNAMSIZ);
+               (void)strlcpy(ifr.ifr_name, ifp->if_xname,
+                   sizeof(ifr.ifr_name));
                if ((ifa = TAILQ_FIRST(&ifp->if_addrlist)) == 0) {
                        memset(&ifr.ifr_addr, 0, sizeof(ifr.ifr_addr));
                        if (ifrp != NULL && space >= sz) {



Home | Main Index | Thread Index | Old Index