1998-04-23 07:31  H.J. Lu  <hjl@gnu.org>

	* resolv/inet_addr.c (inet_aton): Use __strtoul_internal to
	check overflow.
	* resolv/Makefile (tests): New, add tst-aton.
	* resolv/tst-aton.c: New file.

1998-04-29  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/sparc/sparc32/dl-machine.h (WEAKADDR): Add missing
	semicolon.

	* sysdeps/unix/sysv/linux/alpha/bits/signum.h: Add SIGCLD definition.
This commit is contained in:
Ulrich Drepper 1998-04-29 17:14:29 +00:00
parent d079f32126
commit b062f051ec
6 changed files with 63 additions and 4 deletions

View File

@ -1,3 +1,15 @@
1998-04-23 07:31 H.J. Lu <hjl@gnu.org>
* resolv/inet_addr.c (inet_aton): Use __strtoul_internal to
check overflow.
* resolv/Makefile (tests): New, add tst-aton.
* resolv/tst-aton.c: New file.
1998-04-29 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/sparc/sparc32/dl-machine.h (WEAKADDR): Add missing
semicolon.
1998-04-29 12:11 Ulrich Drepper <drepper@cygnus.com> 1998-04-29 12:11 Ulrich Drepper <drepper@cygnus.com>
* wcsmbs/mbsnrtowcs.c: Remove variable to pass to conversion function * wcsmbs/mbsnrtowcs.c: Remove variable to pass to conversion function
@ -13,6 +25,8 @@
* wcsmbs/mbsrtowcs.c: Optimize a bit more. * wcsmbs/mbsrtowcs.c: Optimize a bit more.
* wcsmbs/wcsrtombs.c: Likewise. * wcsmbs/wcsrtombs.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/bits/signum.h: Add SIGCLD definition.
1998-04-29 Ulrich Drepper <drepper@cygnus.com> 1998-04-29 Ulrich Drepper <drepper@cygnus.com>
* iconv/skeleton.c: Correct counting of actually converted * iconv/skeleton.c: Correct counting of actually converted

View File

@ -27,6 +27,8 @@ distribute := ../conf/portability.h mapv4v6addr.h mapv4v6hostent.h \
routines := herror inet_addr inet_ntop inet_pton nsap_addr res_init routines := herror inet_addr inet_ntop inet_pton nsap_addr res_init
tests = tst-aton
include ../Makeconfig include ../Makeconfig
extra-libs := libresolv libnss_dns extra-libs := libresolv libnss_dns

View File

@ -63,6 +63,11 @@ static char rcsid[] = "$Id$";
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <ctype.h> #include <ctype.h>
#ifdef _LIBC
# include <stdlib.h>
# include <limits.h>
# include <errno.h>
#endif
#include "../conf/portability.h" #include "../conf/portability.h"
/* these are compatibility routines, not needed on recent BSD releases */ /* these are compatibility routines, not needed on recent BSD releases */
@ -91,7 +96,7 @@ inet_addr(cp)
*/ */
int int
inet_aton(cp, addr) inet_aton(cp, addr)
register const char *cp; const char *cp;
struct in_addr *addr; struct in_addr *addr;
{ {
register u_int32_t val; /* changed from u_long --david */ register u_int32_t val; /* changed from u_long --david */
@ -99,7 +104,11 @@ inet_aton(cp, addr)
register char c; register char c;
u_int parts[4]; u_int parts[4];
register u_int *pp = parts; register u_int *pp = parts;
#ifdef _LIBC
int saved_errno = errno;
__set_errno (0);
#endif
c = *cp; c = *cp;
for (;;) { for (;;) {
/* /*
@ -109,7 +118,7 @@ inet_aton(cp, addr)
*/ */
if (!isdigit(c)) if (!isdigit(c))
return (0); return (0);
val = 0; base = 10; base = 10;
if (c == '0') { if (c == '0') {
c = *++cp; c = *++cp;
if (c == 'x' || c == 'X') if (c == 'x' || c == 'X')
@ -117,6 +126,16 @@ inet_aton(cp, addr)
else else
base = 8; base = 8;
} }
#ifdef _LIBC
val = strtoul (cp, (char **) &cp, base);
if (val == ULONG_MAX && errno == ERANGE)
{
__set_errno (saved_errno);
return 0;
}
c = *cp;
#else
val = 0;
for (;;) { for (;;) {
if (isascii(c) && isdigit(c)) { if (isascii(c) && isdigit(c)) {
val = (val * base) + (c - '0'); val = (val * base) + (c - '0');
@ -128,6 +147,7 @@ inet_aton(cp, addr)
} else } else
break; break;
} }
#endif
if (c == '.') { if (c == '.') {
/* /*
* Internet format: * Internet format:

22
resolv/tst-aton.c Normal file
View File

@ -0,0 +1,22 @@
#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
enum { buf_size = 16 };
static char buf[buf_size] = "323543357756889";
int
main (int argc, char *argv[])
{
struct in_addr addr;
int result = 0;
if (inet_aton (buf, &addr) != 0)
{
printf ("%s is seen as a valid IP address\n", buf);
result = 1;
}
return result;
}

View File

@ -1,5 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. SPARC version. /* Machine-dependent ELF dynamic relocation inline functions. SPARC version.
Copyright (C) 1996, 1997 Free Software Foundation, Inc. Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -41,7 +41,7 @@ weak_extern(_dl_hwcap_mask);
/* Protect some broken versions of gcc from misinterpreting weak addresses. */ /* Protect some broken versions of gcc from misinterpreting weak addresses. */
#define WEAKADDR(x) ({ __typeof(x) *_px = &x; \ #define WEAKADDR(x) ({ __typeof(x) *_px = &x; \
__asm ("" : "=r" (_px) : "0" (_px)); \ __asm ("" : "=r" (_px) : "0" (_px)); \
_px }) _px; })
/* Use a different preload file when running in 32-bit emulation mode /* Use a different preload file when running in 32-bit emulation mode

View File

@ -52,6 +52,7 @@
#define SIGTSTP 18 #define SIGTSTP 18
#define SIGCONT 19 #define SIGCONT 19
#define SIGCHLD 20 #define SIGCHLD 20
#define SIGCLD SIGCHLD
#define SIGTTIN 21 #define SIGTTIN 21
#define SIGTTOU 22 #define SIGTTOU 22
#define SIGIO 23 #define SIGIO 23