changeset 8556:0fed3810684e

Don't access hints->ai_flags when hints is NULL.
author Bruno Haible <bruno@clisp.org>
date Mon, 26 Mar 2007 10:13:27 +0000
parents 5d2729421f67
children 4dbe36538d4c
files ChangeLog lib/getaddrinfo.c
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-03-25  Bruno Haible  <bruno@clisp.org>
+
+	* lib/getaddrinfo.c (getaddrinfo): Don't access hints->ai_flags when
+	hints is NULL.
+
 2007-03-25  Bruno Haible  <bruno@clisp.org>
 
 	* lib/uniconv/u8-conv-from-enc.c (u8_conv_from_encoding): Add a cast.
--- a/lib/getaddrinfo.c
+++ b/lib/getaddrinfo.c
@@ -179,7 +179,7 @@
       const char *proto =
 	(hints && hints->ai_socktype == SOCK_DGRAM) ? "udp" : "tcp";
 
-      if (!(hints->ai_flags & AI_NUMERICSERV))
+      if (hints == NULL || !(hints->ai_flags & AI_NUMERICSERV))
 	/* FIXME: Use getservbyname_r if available. */
 	se = getservbyname (servname, proto);