diff options
| author | deraadt <> | 1999-06-05 19:33:49 +0000 |
|---|---|---|
| committer | deraadt <> | 1999-06-05 19:33:49 +0000 |
| commit | fd76d3287f3e866b9892ff897340ba4b2b69651e (patch) | |
| tree | b2a5f1add62304a0491a69ad48c344c7a8e6930e /src | |
| parent | c16a142e17c33cb3f3fa17e980732fc0141d9c16 (diff) | |
| download | openbsd-fd76d3287f3e866b9892ff897340ba4b2b69651e.tar.gz openbsd-fd76d3287f3e866b9892ff897340ba4b2b69651e.tar.bz2 openbsd-fd76d3287f3e866b9892ff897340ba4b2b69651e.zip | |
buf oflow; and use inet_aton()
Diffstat (limited to 'src')
| -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); |
