Skip to content

Commit

Permalink
Fix a Use-of-uninitialized-value error
Browse files Browse the repository at this point in the history
```
==13304==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x593eea633f22 in dissect_l2 ndpi/src/lib/third_party/src/fuzz/pl7m.c:306:4
    #1 0x593eea63289a in dissect_do ndpi/src/lib/third_party/src/fuzz/pl7m.c:711:7
    #2 0x593eea63289a in __deserialize_from_fd ndpi/src/lib/third_party/src/fuzz/pl7m.c:1211:8
    #3 0x593eea6301a7 in __deserialize ndpi/src/lib/third_party/src/fuzz/pl7m.c:1241:9
```
Found by oss-fuzz (via nDPI)
  • Loading branch information
IvanNardi committed Jul 23, 2024
1 parent 2c98926 commit 9b5b90b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pl7m.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,13 @@ static int dissect_l2(int datalink_type, struct m_pkt *p)
case DLT_PPP:
case DLT_C_HDLC:
if (data[l2_offset + 0] == 0x0f || data[l2_offset + 0] == 0x8f) {
if (data_len < l2_offset + 4)
return -1;
l3_offset = 4;
l3_proto = ntohs(*((u_int16_t *)&data[l2_offset + 2]));
} else {
if (data_len < l2_offset + 2)
return -1;
l3_offset = l2_offset + 2;
next = ntohs(*((u_int16_t *)&data[l2_offset + 0]));
switch (next) {
Expand Down

0 comments on commit 9b5b90b

Please sign in to comment.