utils: rework fw3_bitlen2netmask() IPv6 mask calculation
authorJo-Philipp Wich <jow@openwrt.org>
Thu, 18 Sep 2014 10:09:12 +0000 (12:09 +0200)
committerJo-Philipp Wich <jow@openwrt.org>
Thu, 18 Sep 2014 11:58:38 +0000 (13:58 +0200)
commit8ea29822ce53c36c91c7b67c6a99b2c50f2c373f
tree46d6a62787924a6045a4bb1b6955527b8d09b8b2
parent10b9190c9d846ae0f9cfd0b0af3d93a99136a40a
utils: rework fw3_bitlen2netmask() IPv6 mask calculation

The previous code wrote beyound the end of the destination buffer under
certain circumstances, causing possible heap corruptions.

Rewrite the IPv6 mask calculation code to use a safe byte-wise assignment
loop instead of two memset() calls and one byte assignment in the middle.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
utils.c