Skip to content

Commit 4f55b5d

Browse files
bostrtFelipe Zimmerle
authored andcommitted
Change from using rand() to thread-safe ap_random_pick.
1 parent cd4218b commit 4f55b5d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

apache2/modsecurity.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ static void modsecurity_persist_data(modsec_rec *msr) {
237237
}
238238

239239
/* Remove stale collections. */
240-
if (rand() < RAND_MAX/100) {
240+
if (ap_random_pick(0, RAND_MAX) < RAND_MAX/100) {
241241
arr = apr_table_elts(msr->collections);
242242
te = (apr_table_entry_t *)arr->elts;
243243
for (i = 0; i < arr->nelts; i++) {

0 commit comments

Comments
 (0)