summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-08-21 20:35:43 +0200
committerRory& <root@rory.gay>2026-08-21 20:35:43 +0200
commit386684fb23f1132f5dcedb99981011fe4c93e5bd (patch)
treeb8dcd4e65ec032325240f69ee8470a2600a03c2b
parentSkip line processing if line doesnt start with a digit (diff)
downloadBlockScrapersC-master.tar.xz
discard non-valid ips HEAD master
Diffstat (limited to '')
-rw-r--r--main.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/main.c b/main.c

index 7ab6ba6..2911c38 100644 --- a/main.c +++ b/main.c
@@ -317,6 +317,8 @@ static void process_line(char* line, void* cbData) return; } + + if (isdigit(line[0]) == 0) { if (print_indeterminate) @@ -332,6 +334,18 @@ static void process_line(char* line, void* cbData) } strncpy(ip, line, strcspn(line, " ")); + int ipLen = (int) strlen(ip); + for (int i = 0; i < ipLen; i++) + { + if (!isdigit(ip[i]) && ip[i] != '.') + { + if (print_indeterminate) + printf("[Indeterminate (Invalid IP)]: %s\n", line); + free(ip); + return; + } + } + // printf("meow %s\n", ip);