summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryangwei <[email protected]>2024-08-08 16:17:40 +0800
committerluwenpeng <[email protected]>2024-08-12 15:48:37 +0800
commit699345b0e6b020e08fd4a9b9addee727038048c6 (patch)
tree9a44b9cc30a4b92c4ffd54886485e4db1eb2cbda
parentf89fc8fc695dbb8e1f66067d504c6ef66c069560 (diff)
🐞 fix(packet utils): Enhanced parameter check
-rw-r--r--src/packet/packet_utils.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/packet/packet_utils.cpp b/src/packet/packet_utils.cpp
index 873b224..708603f 100644
--- a/src/packet/packet_utils.cpp
+++ b/src/packet/packet_utils.cpp
@@ -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;
}