From: Ulrich Drepper Date: Sun, 3 Oct 1999 00:14:09 +0000 (+0000) Subject: Update. X-Git-Tag: cvs/pre-glibc-2_1_3~332 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fcb594165e6433e6533dc4bda5eb319bcb59d465;p=thirdparty%2Fglibc.git Update. * resolv/nsap_addr.c (inet_nsap_addr): Little optimization. * resolv/inet_ntop.c (inet_ntop4): Little optimization. (inet_ntop6): Likewise. --- diff --git a/ChangeLog b/ChangeLog index 33f26621967..072c2363fe2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 1999-10-02 Ulrich Drepper + * resolv/nsap_addr.c (inet_nsap_addr): Little optimization. + + * resolv/inet_ntop.c (inet_ntop4): Little optimization. + (inet_ntop6): Likewise. + * resolv/inet_net_pton.c (inet_net_pton_ipv4): Prevent buffer overruns. diff --git a/resolv/inet_ntop.c b/resolv/inet_ntop.c index 644abee4a77..2f076d4ba4d 100644 --- a/resolv/inet_ntop.c +++ b/resolv/inet_ntop.c @@ -97,8 +97,7 @@ inet_ntop4(src, dst, size) __set_errno (ENOSPC); return (NULL); } - strcpy(dst, tmp); - return (dst); + return strcpy(dst, tmp); } /* const char * @@ -132,8 +131,8 @@ inet_ntop6(src, dst, size) * Find the longest run of 0x00's in src[] for :: shorthanding. */ memset(words, '\0', sizeof words); - for (i = 0; i < IN6ADDRSZ; i++) - words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3)); + for (i = 0; i < IN6ADDRSZ; i += 2) + words[i / 2] = (src[i] << 8) | src[i + 1]; best.base = -1; cur.base = -1; for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) { @@ -194,6 +193,5 @@ inet_ntop6(src, dst, size) __set_errno (ENOSPC); return (NULL); } - strcpy(dst, tmp); - return (dst); + return strcpy(dst, tmp); } diff --git a/resolv/nsap_addr.c b/resolv/nsap_addr.c index 2222cda75af..53a19d59be5 100644 --- a/resolv/nsap_addr.c +++ b/resolv/nsap_addr.c @@ -60,8 +60,7 @@ inet_nsap_addr(ascii, binary, maxlen) continue; if (!isascii(c)) return (0); - if (islower(c)) - c = toupper(c); + c = toupper(c); if (isxdigit(c)) { nib = xtob(c); if ((c = *ascii++)) {