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:
Bernhard Dick 2022-12-23 17:14:35 +01:00 committed by AndersBroman
parent 12591d0a42
commit bf7be8a1ae
1 changed files with 1 additions and 1 deletions

View File

@ -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 );