Skip to content

Commit

Permalink
lib/gis: Fix CWE 398 in user_config (#3874)
Browse files Browse the repository at this point in the history
The error is: Variable 'len' is modified inside assert statement. Assert statements are removed from release builds so the code inside assert statement is not executed. If the code is needed also in release builds, this is a bug.
  • Loading branch information
lbartoletti authored Jun 17, 2024
1 parent f3dd596 commit 6e7787b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/gis/user_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ static int _elem_count_split(char *elems)

/* Some basic assertions */
assert(elems != NULL);
assert((len = strlen(elems)) > 0);

len = strlen(elems);
assert(len > 0);
assert(len < PTRDIFF_MAX);
assert(*elems != '/');

Expand Down

0 comments on commit 6e7787b

Please sign in to comment.