Skip to content

Commit

Permalink
add check for empty cidr
Browse files Browse the repository at this point in the history
This causes tcprewrite to exit with an error instead of crashing.

Fixes: #824
  • Loading branch information
GabrielGanne committed Jan 21, 2024
1 parent 43693c4 commit 236ce27
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/common/cidr.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@ parse_cidr(tcpr_cidr_t **cidrdata, char *cidrin, char *delim)
char *network;
char *token = NULL;

if (cidrin == NULL)

Check warning on line 252 in src/common/cidr.c

View workflow job for this annotation

GitHub Actions / cpp-linter

src/common/cidr.c:252:24 [readability-braces-around-statements]

statement should be inside braces
errx(-1, "%s", "Unable to parse empty CIDR");

mask_cidr6(&cidrin, delim);

/* first iteration of input using strtok */
Expand Down

0 comments on commit 236ce27

Please sign in to comment.