This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gethostbyname() problem?


On Feb  6 00:35, Brian Dessent wrote:
> Index: src/winsup/cygwin/net.cc
> ===================================================================
> RCS file: /cvs/src/src/winsup/cygwin/net.cc,v
> retrieving revision 1.175
> diff -u -p -r1.175 net.cc
> --- src/winsup/cygwin/net.cc	19 Aug 2004 10:58:37 -0000	1.175
> +++ src/winsup/cygwin/net.cc	6 Feb 2005 08:14:41 -0000
> @@ -940,13 +940,13 @@ cygwin_gethostbyname (const char *name)
>    static struct hostent tmp;
>    static char *tmp_aliases[1];
>    static char *tmp_addr_list[2];
> -  static int a, b, c, d;
> +  static int a, b, c, d, n;
>  
>    sig_dispatch_pending ();
>    if (check_null_str_errno (name))
>      return NULL;
>  
> -  if (sscanf (name, "%d.%d.%d.%d", &a, &b, &c, &d) == 4)
> +  if (sscanf (name, "%d.%d.%d.%d%n", &a, &b, &c, &d, &n) == 4 && (unsigned)n == strlen (name))
>      {
>        /* In case you don't have DNS, at least x.x.x.x still works */
>        memset (&tmp, 0, sizeof (tmp));

Thanks for the patch, Brian.  Do you also have a nice ChangeLog entry
for me?


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]