From: Francois-Xavier Le Bail Date: Sun, 8 Jul 2018 13:03:45 +0000 (+0200) Subject: DVMRP: Fix an undefined behavior at runtime X-Git-Tag: tcpdump-4.9.3~118 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/64759158259054a12011ada20cfff503883ed434 DVMRP: Fix an undefined behavior at runtime Found with -fsanitize=undefined clang compiler option. The error was: print-dvmrp.c:238:27: runtime error: left shift of 240 by 24 places cannot be represented in type 'int' (cherry picked from commit bc3e9de3e4cfdf8edc7f486d6918bec8e14903bb) --- diff --git a/print-dvmrp.c b/print-dvmrp.c index e6e87667..36a8d5ba 100644 --- a/print-dvmrp.c +++ b/print-dvmrp.c @@ -231,7 +231,7 @@ print_probe(netdissect_options *ndo, ND_PRINT((ndo, " [|}")); return (0); } - genid = (bp[0] << 24) | (bp[1] << 16) | (bp[2] << 8) | bp[3]; + genid = EXTRACT_32BITS(bp); bp += 4; len -= 4; ND_PRINT((ndo, ndo->ndo_vflag > 1 ? "\n\t" : " "));