summaryrefslogtreecommitdiffstats
path: root/src/net/tcp.c
diff options
context:
space:
mode:
authorMichael Brown2012-05-08 13:47:51 +0200
committerMichael Brown2012-05-08 13:49:01 +0200
commit52dd4bacadb1ec45ecc66abe4ee6bd17fe07e66f (patch)
treea64bfdfe2c1777246a6ccea9b36172ac61915594 /src/net/tcp.c
parent[test] Add self-tests for crc32_le() (diff)
downloadipxe-52dd4bacadb1ec45ecc66abe4ee6bd17fe07e66f.tar.gz
ipxe-52dd4bacadb1ec45ecc66abe4ee6bd17fe07e66f.tar.xz
ipxe-52dd4bacadb1ec45ecc66abe4ee6bd17fe07e66f.zip
[tcp] Fix potential NULL pointer dereference
Detected using Valgrind. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/tcp.c')
-rw-r--r--src/net/tcp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/net/tcp.c b/src/net/tcp.c
index 0a7924a7..5a9810b2 100644
--- a/src/net/tcp.c
+++ b/src/net/tcp.c
@@ -1143,7 +1143,7 @@ static int tcp_rx ( struct io_buffer *iobuf,
flags = tcphdr->flags;
tcp_rx_opts ( tcp, ( ( ( void * ) tcphdr ) + sizeof ( *tcphdr ) ),
( hlen - sizeof ( *tcphdr ) ), &options );
- if ( options.tsopt )
+ if ( tcp && options.tsopt )
tcp->ts_val = ntohl ( options.tsopt->tsval );
iob_pull ( iobuf, hlen );
len = iob_len ( iobuf );