]> git.ipfire.org Git - people/ms/suricata.git/commit
random: fix random logic with getrandom
authorVictor Julien <victor@inliniac.net>
Tue, 24 Oct 2017 10:04:43 +0000 (12:04 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 24 Oct 2017 11:47:02 +0000 (13:47 +0200)
commit7fb58e67831b8dfb5d1ca391c8e99c4f3150142a
treea68ec2661f97d467d3824a4082a834ad385fabfc
parent9b94679fce041bcbbc85904d3bc56addb9ccedc5
random: fix random logic with getrandom

The older random functions returned random values in the range of
0 - RAND_MAX. This is what the http randomize code was expecting.

Newer methods, based on getrandom (or probably Windows too), return
a much large range of values, including negative values and >RAND_MAX.

This patch adds a wrapper to turn the returned value into the expected
range before using it in the http code.

The same is true for the stream engine.
src/app-layer-htp.c
src/stream-tcp.c