In in_pcbconnect(), check the return value from in_pcbbind() and

exit on errors.

If we don't, in_pcbrehash() is called without a preceeding
in_pcbinshash(), causing a crash.

There are apparently several conditions that could cause the crash;
PR misc/12256 is only one of these.

PR:		misc/12256
This commit is contained in:
Pierre Beyssac 1999-06-25 23:46:47 +00:00
parent 94aa67da3b
commit 5a903f8d73
1 changed files with 6 additions and 3 deletions

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)in_pcb.c 8.4 (Berkeley) 5/24/95
* $Id: in_pcb.c,v 1.49 1999/04/28 11:37:44 phk Exp $
* $Id: in_pcb.c,v 1.50 1999/06/17 23:54:50 green Exp $
*/
#include <sys/param.h>
@ -458,8 +458,11 @@ in_pcbconnect(inp, nam, p)
return (EADDRINUSE);
}
if (inp->inp_laddr.s_addr == INADDR_ANY) {
if (inp->inp_lport == 0)
(void)in_pcbbind(inp, (struct sockaddr *)0, p);
if (inp->inp_lport == 0) {
error = in_pcbbind(inp, (struct sockaddr *)0, p);
if (error)
return (error);
}
inp->inp_laddr = ifaddr->sin_addr;
}
inp->inp_faddr = sin->sin_addr;