🐞 fix(packet utils): Enhanced parameter check

This commit is contained in:
yangwei
2024-08-08 16:17:40 +08:00
committed by luwenpeng
parent f89fc8fc69
commit 699345b0e6

View File

@@ -445,7 +445,7 @@ uint16_t packet_get_raw_len(const struct packet *pkt)
const char *packet_get_payload(const struct packet *pkt)
{
if (pkt->layers_used == 0)
if (pkt == NULL || pkt->layers_used == 0)
{
return NULL;
}
@@ -462,7 +462,7 @@ const char *packet_get_payload(const struct packet *pkt)
uint16_t packet_get_payload_len(const struct packet *pkt)
{
if (pkt->layers_used == 0)
if (pkt==NULL || pkt->layers_used == 0)
{
return 0;
}