From 3ddbf0b5f139e7ec0ff3182ddbacca88593e2764 Mon Sep 17 00:00:00 2001 From: Ivan Nardi Date: Wed, 11 Jun 2025 20:46:09 +0200 Subject: TCP fingerprint: fix an undefined-shift ``` ndpi_main.c:7905:33: runtime error: left shift of 255 by 24 places cannot be represented in type 'int' ``` Found by oss-fuzz. See: https://issues.oss-fuzz.com/issues/423959691 --- src/lib/ndpi_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib/ndpi_main.c') diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index c98115cfe..3ecff0fb0 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -7902,7 +7902,7 @@ static int ndpi_init_packet(struct ndpi_detection_module_struct *ndpi_str, else if(opt_len == 3) val = (options[j] << 16) + (options[j+1] << 8) + options[j+2]; else if(opt_len == 4) - val = (options[j] << 24) + (options[j+1] << 16) + (options[j+2] << 8) + options[j+3]; + val = ((u_int32_t)options[j] << 24) + (options[j+1] << 16) + (options[j+2] << 8) + options[j+3]; if(kind == 2) tcp_mss = val; -- cgit v1.2.3