NI_MAXSERV: remove all use of it

Solaris with the SunStudio Compiler is reportedly missing this define,
but as we're using it without any good reason on all the places it was
used I've now instead switched to just use sensible buffer sizes that
fit a 32 bit decimal number. Which also happens to be smaller than the
common NI_MAXSERV value which is 32 on most machines.

Bug: http://curl.haxx.se/bug/view.cgi?id=1277
Reported-by: D.Flinkmann
This commit is contained in:
Daniel Stenberg 2013-09-10 23:18:43 +02:00
Родитель 0d55f4e1bc
Коммит 0b5ae7c80e
3 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -265,7 +265,7 @@ static int getaddrinfo_complete(struct connectdata *conn)
static unsigned int CURL_STDCALL getaddrinfo_thread (void *arg) static unsigned int CURL_STDCALL getaddrinfo_thread (void *arg)
{ {
struct thread_sync_data *tsd = (struct thread_sync_data*)arg; struct thread_sync_data *tsd = (struct thread_sync_data*)arg;
char service [NI_MAXSERV]; char service[12];
int rc; int rc;
snprintf(service, sizeof(service), "%d", tsd->port); snprintf(service, sizeof(service), "%d", tsd->port);
@ -559,7 +559,7 @@ Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
struct in_addr in; struct in_addr in;
Curl_addrinfo *res; Curl_addrinfo *res;
int error; int error;
char sbuf[NI_MAXSERV]; char sbuf[12];
int pf = PF_INET; int pf = PF_INET;
#ifdef CURLRES_IPV6 #ifdef CURLRES_IPV6
struct in6_addr in6; struct in6_addr in6;

Просмотреть файл

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -140,7 +140,7 @@ Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname,
#if defined(HAVE_GETADDRINFO_THREADSAFE) #if defined(HAVE_GETADDRINFO_THREADSAFE)
else { else {
struct addrinfo hints; struct addrinfo hints;
char sbuf[NI_MAXSERV]; char sbuf[12];
char *sbufptr = NULL; char *sbufptr = NULL;
memset(&hints, 0, sizeof(hints)); memset(&hints, 0, sizeof(hints));

Просмотреть файл

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -168,7 +168,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
struct addrinfo hints; struct addrinfo hints;
Curl_addrinfo *res; Curl_addrinfo *res;
int error; int error;
char sbuf[NI_MAXSERV]; char sbuf[12];
char *sbufptr = NULL; char *sbufptr = NULL;
char addrbuf[128]; char addrbuf[128];
int pf; int pf;