]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[tcp] Fix potential NULL pointer dereference
authorMichael Brown <mcb30@ipxe.org>
Tue, 8 May 2012 11:47:51 +0000 (12:47 +0100)
committerMichael Brown <mcb30@ipxe.org>
Tue, 8 May 2012 11:49:01 +0000 (12:49 +0100)
Detected using Valgrind.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/net/tcp.c

index 0a7924a71e7a79d9d0f1ef5bd131a17a6e209dcb..5a9810b2c57bc03cdddcaa94b9ec1baafb1fff5a 100644 (file)
@@ -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 );