Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/ndp ndp(8): host_buf should not be used in delete().



details:   https://anonhg.NetBSD.org/src/rev/5873dd39b600
branches:  trunk
changeset: 320553:5873dd39b600
user:      nonaka <nonaka%NetBSD.org@localhost>
date:      Thu Jul 12 08:16:14 2018 +0000

description:
ndp(8): host_buf should not be used in delete().

host_buf is passed to the argument host of delete() in do_foreach().

diffstat:

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

diffs (31 lines):

diff -r 798eb37ac63b -r 5873dd39b600 usr.sbin/ndp/ndp.c
--- a/usr.sbin/ndp/ndp.c        Thu Jul 12 07:32:35 2018 +0000
+++ b/usr.sbin/ndp/ndp.c        Thu Jul 12 08:16:14 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ndp.c,v 1.52 2018/07/12 07:32:35 nonaka Exp $  */
+/*     $NetBSD: ndp.c,v 1.53 2018/07/12 08:16:14 nonaka Exp $  */
 /*     $KAME: ndp.c,v 1.121 2005/07/13 11:30:13 keiichi Exp $  */
 
 /*
@@ -478,6 +478,7 @@
 static int
 delete(struct rt_msghdr *rtm, char *host)
 {
+       char delete_host_buf[NI_MAXHOST];
        struct sockaddr_in6 *mysin = &sin_m;
        struct sockaddr_dl *sdl;
 
@@ -496,10 +497,10 @@
                mysin->sin6_scope_id = 0;
                inet6_putscopeid(mysin, INET6_IS_ADDR_LINKLOCAL);
                (void)getnameinfo((struct sockaddr *)(void *)&s6,
-                   (socklen_t)s6.sin6_len, host_buf,
-                   sizeof(host_buf), NULL, 0,
+                   (socklen_t)s6.sin6_len, delete_host_buf,
+                   sizeof(delete_host_buf), NULL, 0,
                    (nflag ? NI_NUMERICHOST : 0));
-               (void)printf("%s (%s) deleted\n", host, host_buf);
+               (void)printf("%s (%s) deleted\n", host, delete_host_buf);
        }
 
        return 0;



Home | Main Index | Thread Index | Old Index