Skip to content

Commit

Permalink
tools/nut-scanner/nutscan-ip.c: nutscan_cidr_to_ip(): sanity-check fo…
Browse files Browse the repository at this point in the history
…r cidr==null [networkupstools#2512]

Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov committed Jul 8, 2024
1 parent dd7ff86 commit 2dc471f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tools/nut-scanner/nutscan-ip.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ int nutscan_cidr_to_ip(const char * cidr, char ** start_ip, char ** stop_ip)
WSADATA WSAdata;
#endif

if (!cidr) {
upsdebugx(0, "WARNING: %s: null cidr pointer was provided",
__func__);
return 0;
}

cidr_tok = strdup(cidr);
first_ip = strdup(strtok_r(cidr_tok, "/", &saveptr));
if (first_ip == NULL) {
Expand Down

0 comments on commit 2dc471f

Please sign in to comment.