[freetds] Lookup error

ZIGLIO Frediano Frediano.Ziglio at vodafone.com
Tue Oct 7 18:44:24 EDT 2003


Inside tds_lookup_host there is a strange bug. Assuming we want to
resolve "Idontexist" name:
- inet_addr return INADDR_NONE
- tds_gethostbyname_r return NULL
- we scan invalid "Idontexist" string with sscanf without testing result
- we call tds_gethostbyaddr_r with garbage data, return NULL
I don't understand why we try to do a reverse lookup is host is not
resolved...
Also something tds_gethostbyaddr_r return no-NULL hostent* but no
address so inet_ntoa crash trying to defer a NULL pointer.
inet_ntoa is not thread-safe, we should use inet_ntop if available or
provide a replace.
gethostbyaddr_r is a very old interface, we should use getipnodebyaddr
or getaddrinfo if available (this will solve Mac OS X problem).

freddy77


More information about the FreeTDS mailing list