Module Name: src
Committed By: ryo
Date: Thu Oct 6 06:03:06 UTC 2022
Modified Files:
src/lib/libc/inet: inet_network.c
Log Message:
fix fixPR/57046. inet_network(3) returns INADDR_NONE when network names such as
/x[0-9a-f][0-9a-f]/.
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/inet/inet_network.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/inet/inet_network.c
diff -u src/lib/libc/inet/inet_network.c:1.4 src/lib/libc/inet/inet_network.c:1.5
--- src/lib/libc/inet/inet_network.c:1.4 Sun Jan 20 04:56:08 2008
+++ src/lib/libc/inet/inet_network.c Thu Oct 6 06:03:06 2022
@@ -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 @@ inet_network(const char *cp)
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'))