diff options
Diffstat (limited to 'code/ecp/fe310')
-rw-r--r-- | code/ecp/fe310/transport.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/code/ecp/fe310/transport.c b/code/ecp/fe310/transport.c index a0b4a05..6da5139 100644 --- a/code/ecp/fe310/transport.c +++ b/code/ecp/fe310/transport.c @@ -26,6 +26,11 @@ static void packet_handler(unsigned char *buffer, uint16_t len) { payload.buffer = pld_buf; payload.size = ECP_MAX_PLD; + if ((buffer == NULL) || (len < EOS_SOCK_SIZE_UDP_HDR)) { + eos_net_free(buffer, 0); + return; + } + eos_sock_getfrom(buffer, &addr); ssize_t rv = ecp_pkt_handle(_ecp_tr_sock, &addr, NULL, &bufs, len-EOS_SOCK_SIZE_UDP_HDR); #ifdef ECP_DEBUG |