瀏覽代碼

[tcp] Fix potential NULL pointer dereference

Detected using Valgrind.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 12 年之前
父節點
當前提交
52dd4bacad
共有 1 個檔案被更改,包括 1 行新增1 行删除
  1. 1
    1
      src/net/tcp.c

+ 1
- 1
src/net/tcp.c 查看文件

@@ -1143,7 +1143,7 @@ static int tcp_rx ( struct io_buffer *iobuf,
1143 1143
 	flags = tcphdr->flags;
1144 1144
 	tcp_rx_opts ( tcp, ( ( ( void * ) tcphdr ) + sizeof ( *tcphdr ) ),
1145 1145
 		      ( hlen - sizeof ( *tcphdr ) ), &options );
1146
-	if ( options.tsopt )
1146
+	if ( tcp && options.tsopt )
1147 1147
 		tcp->ts_val = ntohl ( options.tsopt->tsval );
1148 1148
 	iob_pull ( iobuf, hlen );
1149 1149
 	len = iob_len ( iobuf );

Loading…
取消
儲存