]> git.ipfire.org Git - thirdparty/suricata.git/commit
app-layer-htp, stream-tcp: prevent modulo bias in RandomGetWrap() 3183/head
authorMartin Natano <martin.natano@radarservices.com>
Mon, 30 Oct 2017 15:03:25 +0000 (16:03 +0100)
committerVictor Julien <victor@inliniac.net>
Tue, 23 Jan 2018 07:59:34 +0000 (08:59 +0100)
commit18f64e0d21d56a364679eaab7c7fee862290e4b0
tree4213ce35f3c1bd0fedfe80a2f15587b861b72210
parent2e4305f504ae115092320db2cef721b49ada1fe8
app-layer-htp, stream-tcp: prevent modulo bias in RandomGetWrap()

RAND_MAX is not guaranteed to be a divisor of ULONG_MAX, so take the
necessary precautions to get unbiased random numbers. Although the
bias might be negligible, it's not advisable to rely on it.
src/app-layer-htp.c
src/stream-tcp.c