From dec3e2e8aa343f5acdc61df67826b0951b13a663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= Date: Sun, 10 Jul 2016 15:12:05 +0100 Subject: randpkt_core: Use g_random_* for randpkt_parse_type(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit randpkt_parse_type() can (and most likely will) be called before randpkt_example_init(), therefore g_rand_int_range is called with a NULL GRand argument. This produces non-random output. Change-Id: Id420edc15a5f9dec427c5f1a1dd9a1f18a225319 Reviewed-on: https://code.wireshark.org/review/16367 Reviewed-by: João Valverde --- randpkt_core/randpkt_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/randpkt_core/randpkt_core.c b/randpkt_core/randpkt_core.c index b29b18bccc..8e7bce1a69 100644 --- a/randpkt_core/randpkt_core.c +++ b/randpkt_core/randpkt_core.c @@ -723,7 +723,7 @@ int randpkt_parse_type(char *string) /* Called with NULL, choose a random packet */ if (!string) { - return examples[g_rand_int_range(pkt_rand, 0, num_entries)].produceable_type; + return examples[g_random_int_range(0, num_entries)].produceable_type; } for (i = 0; i < num_entries; i++) { -- cgit v1.2.3