forked from osmocom/wireshark
DECT-NWK: Fix possible overflow
Calculating ipei_digits happened using signed int arithmetic due to type promotion rules. Explicitely casting the static number to guint64 ensures usage of unsigned 64bit arithmetics.
This commit is contained in:
parent
12591d0a42
commit
bf7be8a1ae
|
@ -2802,7 +2802,7 @@ static void fmt_dect_nwk_ipei(gchar *ipei_string, guint64 ipei) {
|
|||
psn = ipei & 0xFFFFF;
|
||||
|
||||
digit_divisor = 100000000000;
|
||||
ipei_digits = emc * 10000000 + psn;
|
||||
ipei_digits = emc * (guint64)10000000 + psn;
|
||||
check_digit = 0;
|
||||
for(guint8 i = 1; i <= 12; i++) {
|
||||
check_digit += (guint16)( ( ipei_digits / digit_divisor ) * i );
|
||||
|
|
Loading…
Reference in New Issue