Fix coredump in gethostbyaddr() when the returned answer is too large to

fit in the static buffer.  This fix causes it to look like there is no
 data available, which is also wrong but is better than dumping core.

PR:		bin/10344
Reviewed by:	billf
Approved by:	jkh
This commit is contained in:
Bill Fenner 2000-02-16 04:39:00 +00:00
parent 528b8853bb
commit 686d0736aa
1 changed files with 4 additions and 0 deletions

View File

@ -664,6 +664,10 @@ _gethostbydnsaddr(addr, len, af)
dprintf("res_query failed (%d)\n", n);
return (NULL);
}
if (n > sizeof buf.buf) {
dprintf("static buffer is too small (%d)\n", n);
return (NULL);
}
if (!(hp = gethostanswer(&buf, n, qbuf, T_PTR)))
return (NULL); /* h_errno was set by gethostanswer() */
#ifdef SUNSECURITY