From: Simon Josefsson Date: Fri, 17 Nov 2006 13:47:43 +0000 (+0000) Subject: Revert Jim's 2006-10-23 patch. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f9d72badae87981d247cd2e34eb9e3e8455d156;p=pspp Revert Jim's 2006-10-23 patch. --- diff --git a/ChangeLog b/ChangeLog index 770dc45466..24159e6693 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-11-16 Paul Eggert + + * modules/getaddinfo (Depends-on): Remove inttostr; add snprintf. + * lib/getaddrinfo.c: Include snprintf.h rather than intprops.h + and inttostr.h. Use snprintf rather than uinttostr, so that + LGPLed code doesn't depend on GPLed. + 2006-11-17 Paul Eggert * modules/inline (License): Change from GPL to LGPL. diff --git a/lib/getaddrinfo.c b/lib/getaddrinfo.c index 358214afec..f523f7658e 100644 --- a/lib/getaddrinfo.c +++ b/lib/getaddrinfo.c @@ -38,8 +38,7 @@ #define N_(String) String #include "inet_ntop.h" -#include "intprops.h" -#include "inttostr.h" +#include "snprintf.h" #include "strdup.h" /* BeOS has AF_INET, but not PF_INET. */ @@ -408,11 +407,8 @@ int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen, { unsigned short int port = ntohs (((const struct sockaddr_in *) sa)->sin_port); - char buf[INT_BUFSIZE_BOUND (port)]; - char const *s = uinttostr (port, buf); - if (strlen (s) + 1 > servicelen) + if (servicelen <= snprintf (service, servicelen, "%u", port)) return EAI_OVERFLOW; - memcpy (service, s, strlen (s) + 1); } break; } diff --git a/modules/getaddrinfo b/modules/getaddrinfo index 8f5979db38..b2b6a3574a 100644 --- a/modules/getaddrinfo +++ b/modules/getaddrinfo @@ -10,7 +10,7 @@ m4/getaddrinfo.m4 Depends-on: gettext-h inet_ntop -inttostr +snprintf socklen stdbool strdup