From 2c98926397e7f18febf831366361ee44216af0de Mon Sep 17 00:00:00 2001 From: Nardi Ivan Date: Thu, 11 Jul 2024 08:39:52 +0200 Subject: [PATCH] Fix a Use-of-uninitialized-value error ``` ==1899==WARNING: MemorySanitizer: use-of-uninitialized-value #0 0x59a0a2567a0b in dissect_l2 ndpi/src/lib/third_party/src/fuzz/pl7m.c:291:6 #1 0x59a0a25663ea in dissect_do ndpi/src/lib/third_party/src/fuzz/pl7m.c:711:7 #2 0x59a0a25663ea in __deserialize_from_fd ndpi/src/lib/third_party/src/fuzz/pl7m.c:1211:8 #3 0x59a0a2564147 in __deserialize ndpi/src/lib/third_party/src/fuzz/pl7m.c:1241:9 #4 0x59a0a2564147 in pl7m_mutator ndpi/src/lib/third_party/src/fuzz/pl7m.c:1296:6 ``` Found by oss-fuzz (via nDPI) --- pl7m.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pl7m.c b/pl7m.c index d3c5072..bf502b6 100644 --- a/pl7m.c +++ b/pl7m.c @@ -284,7 +284,7 @@ static int dissect_l2(int datalink_type, struct m_pkt *p) break; case DLT_PPI: - if (data_len < l2_offset + 4) + if (data_len < l2_offset + 8) return -1; header_length = le16toh(*(u_int16_t *)&data[l2_offset + 2]); dlt = le32toh(*(u_int32_t *)&data[l2_offset + 4]);