Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/inet fix fixPR/57046. inet_network(3) returns INADD...



details:   https://anonhg.NetBSD.org/src/rev/137fba8a0496
branches:  trunk
changeset: 371752:137fba8a0496
user:      ryo <ryo%NetBSD.org@localhost>
date:      Thu Oct 06 06:03:06 2022 +0000

description:
fix fixPR/57046. inet_network(3) returns INADDR_NONE when network names such as /x[0-9a-f][0-9a-f]/.

diffstat:

 lib/libc/inet/inet_network.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (33 lines):

diff -r 1d784d3dc7af -r 137fba8a0496 lib/libc/inet/inet_network.c
--- a/lib/libc/inet/inet_network.c      Thu Oct 06 00:22:16 2022 +0000
+++ b/lib/libc/inet/inet_network.c      Thu Oct 06 06:03:06 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: inet_network.c,v 1.4 2008/01/20 04:56:08 christos Exp $        */
+/*     $NetBSD: inet_network.c,v 1.5 2022/10/06 06:03:06 ryo Exp $     */
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)inet_network.c     8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: inet_network.c,v 1.4 2008/01/20 04:56:08 christos Exp $");
+__RCSID("$NetBSD: inet_network.c,v 1.5 2022/10/06 06:03:06 ryo Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -71,10 +71,11 @@
 
 again:
        val = 0; base = 10; digit = 0;
-       if (*cp == '0')
+       if (*cp == '0') {
                digit = 1, base = 8, cp++;
-       if (*cp == 'x' || *cp == 'X')
-               digit = 0, base = 16, cp++;
+               if (*cp == 'x' || *cp == 'X')
+                       digit = 0, base = 16, cp++;
+       }
        while ((c = *cp) != 0) {
                if (isdigit(c)) {
                        if (base == 8 && (c == '8' || c == '9'))



Home | Main Index | Thread Index | Old Index