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: appneta#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)
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.