]> git.ipfire.org Git - thirdparty/hostap.git/commit
UBSan: Avoid unsigned integer overflow in utf8_{,un}escape()
authorJouni Malinen <j@w1.fi>
Sat, 23 Feb 2019 14:03:47 +0000 (16:03 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 25 Feb 2019 17:48:49 +0000 (19:48 +0200)
commitfed7d8fcba68729fe7de9018422c0006fd00c642
tree96a103bd054fdb458a7ea8795063a64382c848a7
parentcc4cdefc7f78214bc11e71609d24ef564ce0a6c7
UBSan: Avoid unsigned integer overflow in utf8_{,un}escape()

Split the if/while loop condition into two independent steps so that
in_size-- happens only in the case in_size is nonzero. This gets rid of
unnecessary UBSan warnings.

common.c:1087:16: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'size_t' (aka 'unsigned long')
common.c:1076:16: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'size_t' (aka 'unsigned long')
common.c:1119:16: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'size_t' (aka 'unsigned long')

Signed-off-by: Jouni Malinen <j@w1.fi>
src/utils/common.c