From 5a903f8d735f0cc4a378e9f85fa3ad30a675df06 Mon Sep 17 00:00:00 2001 From: Pierre Beyssac Date: Fri, 25 Jun 1999 23:46:47 +0000 Subject: [PATCH] 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 --- sys/netinet/in_pcb.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index d66e598652f..87d8c457a7e 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -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 @@ -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;