sudo-project / sudo

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

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

Closed AtariDreams closed 1 year ago

AtariDreams 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.

AtariDreams commented 1 year ago

@millert Done!