🐞 fix(packet utils): Enhanced parameter check
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user