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
Signed-off-by: Gabriel Ganne <[email protected]>
  • Loading branch information
GabrielGanne committed Jan 21, 2024
1 parent 43693c4 commit a0b6d84
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/common/cidr.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ 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 a0b6d84

Please sign in to comment.