Hi there,
Please review the attached patch. It stops all sorts of coredumps
when wget is given an unresolvable hostname. The problem is fairly
obvious: when inet_pton() returns an error, it doesn't fill in *addr,
and so gethostbyaddr() has a garbage argument which causes wget to
crash on FreeBSD. You really want to run gethostbyaddr() if
inet_pton() says the address is a valid presentation-format numeric
address.
Kris
diff -ru work/wget-1.7/src/host.c wget-1.7/src/host.c
--- work/wget-1.7/src/host.c Wed Aug 8 05:22:45 2001
+++ src/host.c Wed Aug 8 05:19:42 2001
@@ -106,7 +106,7 @@
hp = gethostbyname2(name, af);
if (!hp) {
- if (inet_pton(af, name, addr) != -1) {
+ if (inet_pton(af, name, addr) == 1) {
switch (af) {
case AF_INET:
socksize = sizeof (struct sockaddr_in);
PGP signature