Fix some bit-shifting overflow/UB issues reported by Coverity

This commit is contained in:
Tim Wojtulewicz 2025-07-21 15:24:00 -07:00
parent 22e78c3c24
commit d4cb3c8225
2 changed files with 9 additions and 1 deletions

View file

@ -751,7 +751,7 @@ IPAddr SubNetVal::Mask() const {
for ( w = subnet_val->Length(); w >= 32; w -= 32 )
*(mp++) = 0xffffffff;
*mp = ~((1 << (32 - w)) - 1);
*mp = ~((static_cast<uint32_t>(1) << (32 - w)) - 1);
while ( ++mp < m + 4 )
*mp = 0;