projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add sanity check for return of sotoinpcb() and intotcpcb()
[unix-history]
/
sys
/
netinet
/
tcp_usrreq.c
diff --git
a/sys/netinet/tcp_usrreq.c
b/sys/netinet/tcp_usrreq.c
index
aaa7fbf
..
0ddf870
100644
(file)
--- a/
sys/netinet/tcp_usrreq.c
+++ b/
sys/netinet/tcp_usrreq.c
@@
-31,7
+31,7
@@
* SUCH DAMAGE.
*
* from: @(#)tcp_usrreq.c 7.15 (Berkeley) 6/28/90
* SUCH DAMAGE.
*
* from: @(#)tcp_usrreq.c 7.15 (Berkeley) 6/28/90
- * $Id: tcp_usrreq.c,v 1.
3 1993/11/25 01:35:20 wollman
Exp $
+ * $Id: tcp_usrreq.c,v 1.
5 1994/01/24 05:12:36 davidg
Exp $
*/
#include "param.h"
*/
#include "param.h"
@@
-58,7
+58,9
@@
#include "tcp_timer.h"
#include "tcp_var.h"
#include "tcpip.h"
#include "tcp_timer.h"
#include "tcp_var.h"
#include "tcpip.h"
+#ifdef TCPDEBUG
#include "tcp_debug.h"
#include "tcp_debug.h"
+#endif
/*
* TCP protocol interface to socket abstraction.
/*
* TCP protocol interface to socket abstraction.
@@
-332,8
+334,10
@@
tcp_usrreq(so, req, m, nam, control, dummy)
default:
panic("tcp_usrreq");
}
default:
panic("tcp_usrreq");
}
+#ifdef TCPDEBUG
if (tp && (so->so_options & SO_DEBUG))
tcp_trace(TA_USER, ostate, tp, (struct tcpiphdr *)0, req);
if (tp && (so->so_options & SO_DEBUG))
tcp_trace(TA_USER, ostate, tp, (struct tcpiphdr *)0, req);
+#endif
splx(s);
return (error);
}
splx(s);
return (error);
}
@@
-347,12
+351,15
@@
tcp_ctloutput(op, so, level, optname, mp)
{
int error = 0;
struct inpcb *inp = sotoinpcb(so);
{
int error = 0;
struct inpcb *inp = sotoinpcb(so);
- register struct tcpcb *tp
= intotcpcb(inp)
;
+ register struct tcpcb *tp;
register struct mbuf *m;
if (level != IPPROTO_TCP)
return (ip_ctloutput(op, so, level, optname, mp));
register struct mbuf *m;
if (level != IPPROTO_TCP)
return (ip_ctloutput(op, so, level, optname, mp));
+ if (!inp || !(tp = intotcpcb(inp)))
+ return (EINVAL);
+
switch (op) {
case PRCO_SETOPT:
switch (op) {
case PRCO_SETOPT: