Module Name:    src
Committed By:   nonaka
Date:           Thu Jul 12 08:16:14 UTC 2018

Modified Files:
        src/usr.sbin/ndp: ndp.c

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/usr.sbin/ndp/ndp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/ndp/ndp.c
diff -u src/usr.sbin/ndp/ndp.c:1.52 src/usr.sbin/ndp/ndp.c:1.53
--- src/usr.sbin/ndp/ndp.c:1.52	Thu Jul 12 07:32:35 2018
+++ src/usr.sbin/ndp/ndp.c	Thu Jul 12 08:16:14 2018
@@ -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 @@ delete_one(char *host)
 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 @@ delete(struct rt_msghdr *rtm, char *host
 		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;

Reply via email to