diff options
author | Bill Fenner <fenner@gmail.com> | 2022-10-11 13:13:58 -0700 |
---|---|---|
committer | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2023-04-19 19:29:26 +0200 |
commit | df5cba8d99ed9b99ecf1da9e4e0a115509209a91 (patch) | |
tree | b5d226c17c121361bd5b97c823494670637a3f01 /instrument-functions.c | |
parent | 541c1ab5e795684abb3e3b372a68055404190a1a (diff) | |
download | tcpdump-df5cba8d99ed9b99ecf1da9e4e0a115509209a91.tar.gz |
SNMP: Fix two undefined behaviors
When converting an integer from ASN.1, use an unsigned value
for the partial result and assign it to the integer part of
the union at the end, to avoid shifting a negative number left.
print-snmp.c:545:19: runtime error: left shift of negative value -1
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior print-snmp.c:545:19
OID elements are unsigned; a large-enough oid value could result
in the undefined behavior of shifting a signed integer left through
the sign bit, so simply store them as unsigned.
print-snmp.c:751:11: runtime error: left shift of 268435455 by 7 places
cannot be represented in type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior print-snmp.c:751:11
[Part of the PR #1012]
Diffstat (limited to 'instrument-functions.c')
0 files changed, 0 insertions, 0 deletions