diff options
author | Nathaniel Ferguson <nathaniel@leapfrog.foundation> | 2020-05-03 03:12:37 -0400 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2020-05-04 13:56:21 +0200 |
commit | 9d71c0f9341711c5b0094bf95d087251689112a4 (patch) | |
tree | 36792459c0be24845f80ac1e1a9cd532a8ecb349 /proto_ipv4.c | |
parent | 21b9cc33337e904dee4cac87794291ca95a148dd (diff) |
proto_ipv4: Make netsniff detect and properly handle some malformed packets
Entails the potential integer underflow of a signed integer.
Signed-off-by: Nathaniel Ferguson <nathaniel@leapfrog.foundation>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'proto_ipv4.c')
-rw-r--r-- | proto_ipv4.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/proto_ipv4.c b/proto_ipv4.c index e2d22d8..e522a90 100644 --- a/proto_ipv4.c +++ b/proto_ipv4.c @@ -154,7 +154,7 @@ static void ipv4(struct pkt_buff *pkt) * check and handle that */ opt_len = *(++opt); - if (opt_len > opts_len) { + if (opt_len < 2 || opt_len > opts_len) { tprintf(", Len (%zd, invalid) ]\n", opt_len); goto out; } else |