sudo-project / sudo

Utility to execute a command as another user
https://www.sudo.ws
Other
1.2k stars 224 forks source link

Check for integer overflow after rounding up to the nearest power of 2 #284

Closed AreaZR closed 1 year ago

AreaZR commented 1 year ago

We should be checking for integer overflow, rather than checking if size is 0.

Additionally, we should set errno to ENOMEM when this overflow happens.

Finally, the most efficient implementation of the round-up-to-2 algorithm involves the clz intrinsic.

AreaZR commented 1 year ago

@millert Done!