Avoid a theoretical integer overflow in base64_encode()
authorJouni Malinen <j@w1.fi>
Thu, 13 Aug 2009 13:36:41 +0000 (16:36 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 13 Aug 2009 13:36:41 +0000 (16:36 +0300)
commit6b23b70445ee091722bc4a9d3933ae16a880d238
tree672cab7bd407a884501e89eb4e081c9e99bc54e3
parent061971b5f8ed47bdad7c0adfbdcfda16881096a2
Avoid a theoretical integer overflow in base64_encode()

If base64_encode() were to be used with a huge data array, the
previous version could have resulted in overwriting the allocated
buffer due to an integer overflow as pointed out in
http://www.freebsd.org/cgi/query-pr.cgi?pr=137484. However, there
are no know use cases in hostapd or wpa_supplicant that would do that.
Anyway, the recommended change looks reasonable and provides additional
protection should the base64_encode() function be used for something
else in the future.
src/utils/base64.c