diff --git a/sys/net/application_layer/asymcute/asymcute.c b/sys/net/application_layer/asymcute/asymcute.c index 983d3ff15c1a33599c978cc1cd1753d6fa732b24..b3379820e81b12457624412fb2a7a7e048d5f93b 100644 --- a/sys/net/application_layer/asymcute/asymcute.c +++ b/sys/net/application_layer/asymcute/asymcute.c @@ -516,6 +516,10 @@ static void _on_unsuback(asymcute_con_t *con, const uint8_t *data, size_t len) static void _on_data(asymcute_con_t *con, size_t pkt_len, sock_udp_ep_t *remote) { + if (pkt_len < 2) { + return; + } + size_t len; size_t pos = _len_get(con->rxbuf, &len); @@ -524,8 +528,7 @@ static void _on_data(asymcute_con_t *con, size_t pkt_len, sock_udp_ep_t *remote) return; } /* validate incoming data: verify message length */ - if ((pkt_len < 2) || - (pkt_len <= pos) || (pkt_len < len)) { + if ((pkt_len <= pos) || (pkt_len < len)) { /* length field of MQTT-SN packet seems to be invalid -> drop the pkt */ return; }