diff options
-rw-r--r-- | src/usr.bin/nc/netcat.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/usr.bin/nc/netcat.c b/src/usr.bin/nc/netcat.c index bb0b30749d..bad1676007 100644 --- a/src/usr.bin/nc/netcat.c +++ b/src/usr.bin/nc/netcat.c | |||
@@ -344,7 +344,7 @@ HINF * gethostpoop (name, numeric) | |||
344 | Maybe that's why my C code reads like assembler half the time... */ | 344 | Maybe that's why my C code reads like assembler half the time... */ |
345 | 345 | ||
346 | /* If we want to see all the DNS stuff, do the following hair -- | 346 | /* If we want to see all the DNS stuff, do the following hair -- |
347 | if inet_addr, do reverse and forward with any warnings; otherwise try | 347 | if inet_aton, do reverse and forward with any warnings; otherwise try |
348 | to do forward and reverse with any warnings. In other words, as long | 348 | to do forward and reverse with any warnings. In other words, as long |
349 | as we're here, do a complete DNS check on these clowns. Yes, it slows | 349 | as we're here, do a complete DNS check on these clowns. Yes, it slows |
350 | things down a bit for a first run, but once it's cached, who cares? */ | 350 | things down a bit for a first run, but once it's cached, who cares? */ |
@@ -355,11 +355,9 @@ HINF * gethostpoop (name, numeric) | |||
355 | poop = (HINF *) Hmalloc (sizeof (HINF)); | 355 | poop = (HINF *) Hmalloc (sizeof (HINF)); |
356 | if (! poop) | 356 | if (! poop) |
357 | bail ("gethostpoop fuxored"); | 357 | bail ("gethostpoop fuxored"); |
358 | strcpy (poop->name, unknown); /* preload it */ | 358 | strlcpy (poop->name, unknown, sizeof(poop->name)); /* preload it */ |
359 | /* see wzv:workarounds.c for dg/ux return-a-struct inet_addr lossage */ | 359 | if (inet_aton (name, &iaddr) == 0) { /* here's the great split: names... */ |
360 | iaddr.s_addr = inet_addr (name); | ||
361 | 360 | ||
362 | if (iaddr.s_addr == INADDR_NONE) { /* here's the great split: names... */ | ||
363 | if (numeric) | 361 | if (numeric) |
364 | bail ("Can't parse %s as an IP address", name); | 362 | bail ("Can't parse %s as an IP address", name); |
365 | hostent = gethostbyname (name); | 363 | hostent = gethostbyname (name); |