Fix undefined behaviour: shifting signed int by 31 place

see #465

     #0 0x555719469ec5 in AddAnyPortMapping.cfi /home/ryutaroh/miniupnpd-1018/miniupnp/miniupnpd/upnpsoap.c:703:42
     #1 0x5557194705a7 in ExecuteSoapAction /home/ryutaroh/miniupnpd-1018/miniupnp/miniupnpd/upnpsoap.c:2335:5
 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior upnpsoap.c:703:42 in
This commit is contained in:
Thomas Bernard 2020-10-26 08:46:37 +01:00
parent 92ff8a6a7e
commit 90259ae803
No known key found for this signature in database
GPG Key ID: DB511043A31ACAAF
1 changed files with 1 additions and 1 deletions

View File

@ -700,7 +700,7 @@ AddAnyPortMapping(struct upnphttp * h, const char * action, const char * ns)
} else {
eport = ++eport_above;
}
if (!(allowed_eports[eport / 32] & (1 << eport % 32)))
if (!(allowed_eports[eport / 32] & ((uint32_t)1U << (eport % 32))))
continue; /* not allowed */
r = upnp_redirect(r_host, eport, int_ip, iport, protocol, desc, leaseduration);
if (r == 0 || r == -1) {