]> git.ipfire.org Git - thirdparty/suricata.git/commit
util-hash-lookup3: Add hashlittle_safe() variant
authorJustin Viiret <justin.viiret@intel.com>
Mon, 28 Mar 2016 22:32:26 +0000 (09:32 +1100)
committerVictor Julien <victor@inliniac.net>
Tue, 29 Mar 2016 10:43:29 +0000 (12:43 +0200)
commitc8e01a3d62c116ee5cad4d4a86c300d55d3781e9
tree8d6776fc6f338737037a4d59e5722f3594d6f1d9
parent30410e6900449a7f6d5798d5ac7bb86b7bd2b58d
util-hash-lookup3: Add hashlittle_safe() variant

By default, hashlittle() will read off the end of the key, up to the
next four-byte boundary, although the data beyond the end of the key
doesn't affect the hash. This read causes uninitialized read warnings
from Valgrind and Address Sanitizer.

Here we add hashlittle_safe(), which avoids reading off the end of the
buffer (using the code inside the VALGRIND-guarded block in the original
hashlittle() implementation).
src/util-hash-lookup3.c
src/util-hash-lookup3.h