Skip to content

Commit

Permalink
Fix segfault if help option is use without test specification.
Browse files Browse the repository at this point in the history
Global default test option is -1, so the code reads memory
outside of the array.
  • Loading branch information
mbroz committed Aug 5, 2022
1 parent 789c28e commit 7d60208
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dieharder/help.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void help()

/* printf("OK, what is dtest_num = %u\n",dtest_num);*/

if(dh_test_types[dtest_num]){
if(dtest_num>=0 && dtest_num < MAXTESTS && dh_test_types[dtest_num]){
fprintf(stdout,"%s",dh_test_types[dtest_num]->description);
Exit(0);
} else {
Expand Down

0 comments on commit 7d60208

Please sign in to comment.