Skip to content

Commit

Permalink
tests: don't dereference a var before checking it.
Browse files Browse the repository at this point in the history
The strchr() return a NULL if the character is not found. Make sure to
handle that.

Signed-off-by: Robin Getz <[email protected]>
  • Loading branch information
rgetz authored and pcercuei committed Apr 27, 2023
1 parent 6136f11 commit c61f450
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/gen_code.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ bool gen_test_path(const char *gen_file)
return false;

last = strrchr(gen_file, '.');
if (*last != '.')
if (!last)
return false;
last++;

Expand Down

0 comments on commit c61f450

Please sign in to comment.