checkpoint

This commit is contained in:
Mark Andrews 2001-04-03 07:21:35 +00:00
parent 3b371eaa5d
commit 8a3e0f66c1
3 changed files with 13 additions and 10 deletions

View file

@ -70,7 +70,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93";
static const char rcsid[] = "$Id: inet_addr.c,v 1.1 2001/03/29 06:31:37 marka Exp $";
static const char rcsid[] = "$Id: inet_addr.c,v 1.2 2001/04/03 07:21:32 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
@ -121,7 +121,7 @@ inet_aton(const char *cp, struct in_addr *addr) {
* Values are specified as for C:
* 0x=hex, 0=octal, isdigit=decimal.
*/
if (!isdigit(c))
if (!isdigit((unsigned char)c))
return (0);
val = 0; base = 10; digit = 0;
if (c == '0') {
@ -134,15 +134,16 @@ inet_aton(const char *cp, struct in_addr *addr) {
}
}
for (;;) {
if (isascii(c) && isdigit(c)) {
if (isascii(c) && isdigit((unsigned char)c)) {
if (base == 8 && (c == '8' || c == '9'))
return (0);
val = (val * base) + (c - '0');
c = *++cp;
digit = 1;
} else if (base == 16 && isascii(c) && isxdigit(c)) {
} else if (base == 16 && isascii(c) &&
isxdigit((unsigned char)c)) {
val = (val << 4) |
(c + 10 - (islower(c) ? 'a' : 'A'));
(c + 10 - (islower((unsigned char)c) ? 'a' : 'A'));
c = *++cp;
digit = 1;
} else
@ -165,7 +166,7 @@ inet_aton(const char *cp, struct in_addr *addr) {
/*
* Check for trailing characters.
*/
if (c != '\0' && (!isascii(c) || !isspace(c)))
if (c != '\0' && (!isascii(c) || !isspace((unsigned char)c)))
return (0);
/*
* Did we get a valid digit?

View file

@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
static const char rcsid[] = "$Id: inet_cidr_pton.c,v 1.1 2001/03/29 06:31:37 marka Exp $";
static const char rcsid[] = "$Id: inet_cidr_pton.c,v 1.2 2001/04/03 07:21:34 marka Exp $";
#endif
#include "port_before.h"
@ -101,7 +101,8 @@ inet_cidr_pton_ipv4(const char *src, u_char *dst, int *pbits) {
/* Get the prefix length if any. */
bits = -1;
if (ch == '/' && isascii(src[0]) && isdigit(src[0]) && dst > odst) {
if (ch == '/' && isascii((unsigned char)(src[0])) &&
isdigit((unsigned char)(src[0])) && dst > odst) {
/* CIDR width specifier. Nothing can follow it. */
ch = *src++; /* Skip over the /. */
bits = 0;

View file

@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
static const char rcsid[] = "$Id: inet_net_pton.c,v 1.3 2001/04/03 06:42:19 marka Exp $";
static const char rcsid[] = "$Id: inet_net_pton.c,v 1.4 2001/04/03 07:21:35 marka Exp $";
#endif
#include "port_before.h"
@ -159,7 +159,8 @@ inet_net_pton_ipv4(src, dst, size)
goto enoent;
bits = -1;
if (ch == '/' && isascii(src[0]) && isdigit(src[0]) && dst > odst) {
if (ch == '/' && isascii((unsigned char)(src[0])) &&
isdigit((unsigned char)(src[0])) && dst > odst) {
/* CIDR width specifier. Nothing can follow it. */
ch = *src++; /* Skip over the /. */
bits = 0;