]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Use fr_fast_rand() to select operation in burn-in (CID #1503935, #1504015) (#4503)
authorJames Jones <jejones3141@gmail.com>
Wed, 11 May 2022 21:06:40 +0000 (16:06 -0500)
committerGitHub <noreply@github.com>
Wed, 11 May 2022 21:06:40 +0000 (17:06 -0400)
src/lib/util/lst_tests.c
src/lib/util/minmax_heap_tests.c

index 092dcb391faa12f205b536397f7fd46bde50f898..4caa738b8e62d85f97af1c0a2bdcdffd96d51d22 100644 (file)
@@ -280,7 +280,7 @@ static void lst_burn_in(void)
                        TEST_CHECK((ret_insert = fr_lst_insert(lst, &array[insert_count])) >= 0);
                        insert_count++;
                } else {
-                       switch (rand() % 3) {
+                       switch (fr_fast_rand(&rand_ctx) % 3) {
                        case 0: /* insert */
                                goto insert;
 
index 0b4c29e9262912643fb1a809120d63325593a572..c3b2216f5d002f187d2213c6d7a687dced4123da 100644 (file)
@@ -250,7 +250,7 @@ static void minmax_heap_burn_in(void)
                        TEST_CHECK((ret_insert = fr_minmax_heap_insert(hp, &array[insert_count])) >= 0);
                        insert_count++;
                } else {
-                       switch (rand() % 5) {
+                       switch (fr_fast_rand(&rand_ctx) % 5) {
                        case 0: /* insert */
                                goto insert;