Source-Changes-HG archive

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

[src/trunk]: src/sbin/route Avoid undefined behavior



details:   https://anonhg.NetBSD.org/src/rev/68e4319b7dca
branches:  trunk
changeset: 969465:68e4319b7dca
user:      kamil <kamil%NetBSD.org@localhost>
date:      Sat Feb 22 00:42:15 2020 +0000

description:
Avoid undefined behavior

route.c:1523:20, left shift of 1073741824 by 1 places cannot be represented
in type 'int'

diffstat:

 sbin/route/route.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r d8d080680deb -r 68e4319b7dca sbin/route/route.c
--- a/sbin/route/route.c        Sat Feb 22 00:38:14 2020 +0000
+++ b/sbin/route/route.c        Sat Feb 22 00:42:15 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route.c,v 1.165 2020/01/22 19:22:06 roy Exp $  */
+/*     $NetBSD: route.c,v 1.166 2020/02/22 00:42:15 kamil Exp $        */
 
 /*
  * Copyright (c) 1983, 1989, 1991, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)route.c    8.6 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: route.c,v 1.165 2020/01/22 19:22:06 roy Exp $");
+__RCSID("$NetBSD: route.c,v 1.166 2020/02/22 00:42:15 kamil Exp $");
 #endif
 #endif /* not lint */
 
@@ -1498,7 +1498,7 @@
        struct sockaddr_dl *ifp = NULL;
        struct sockaddr *sa;
        char *cp;
-       int i;
+       unsigned int i;
 
        if (! shortoutput) {
                (void)printf("   route to: %s\n",



Home | Main Index | Thread Index | Old Index