net: tcp2: Guard against th_get() on NULL pkt

This problem was overlooked earlier and was found while
testing TCP2 client side.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
This commit is contained in:
Oleg Zhurakivskyy 2020-03-06 15:21:49 +02:00 committed by Jukka Rissanen
commit 038618dbc8

View file

@ -993,7 +993,7 @@ err:
/* TCP state machine, everything happens here */
static void tcp_in(struct tcp *conn, struct net_pkt *pkt)
{
struct tcphdr *th = th_get(pkt);
struct tcphdr *th = pkt ? th_get(pkt) : NULL;
u8_t next = 0, fl = th ? th->th_flags : 0;
size_t len;