net: contiki: Prevent a null dereference

When first starting the board, uip_connr may be NULL. This causes an
invalid pointer dereference. Add a NULL check.

Change-Id: Ia5d9897038a22fe44aab5106dd6b84c5a358512d
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
This commit is contained in:
Jaakko Hannikainen 2016-07-29 14:03:15 +03:00 committed by Andrew Boie
commit 0766d3b921
2 changed files with 2 additions and 2 deletions

View file

@ -2193,7 +2193,7 @@ uip_process(struct net_buf **buf_out, uint8_t flag)
#if UIP_TCP
/* Clear any pending packet */
if (uip_connr->buf) {
if (uip_connr && uip_connr->buf) {
tcp_cancel_retrans_timer(uip_connr);
switch (uip_connr->tcpstateflags & UIP_TS_MASK) {
case UIP_FIN_WAIT_1:

View file

@ -2577,7 +2577,7 @@ tcp_send_syn:
#if UIP_TCP
/* Clear any pending packet */
if (uip_connr->buf) {
if (uip_connr && uip_connr->buf) {
tcp_cancel_retrans_timer(uip_connr);
switch (uip_connr->tcpstateflags & UIP_TS_MASK) {
case UIP_FIN_WAIT_1: