statzone

DNS zone file analyzer targeted at TLD zones
Log | Files | Refs | README | LICENSE

commit 225eeba87f86d29db7fb42f41f8e5fd341bf6e6b
parent 2f0c9ae4b69e7ca5ab362de948e61d89b87c73b3
Author: Frederic Cambus <fred@statdns.com>
Date:   Fri, 15 Feb 2019 13:04:08 +0100

Check if rdata isn't NULL before attempting to use its value.

Diffstat:
Msrc/statzone.c | 14++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/statzone.c b/src/statzone.c @@ -180,12 +180,14 @@ main(int argc, char *argv[]) { rdata = strtok(NULL, "\n"); - HASH_FIND_STR(uniqueNS, rdata, ns); - - if (!ns) { - ns = malloc(sizeof(struct my_struct)); - ns->domain = strdup(rdata); - HASH_ADD_STR(uniqueNS, domain, ns); + if (rdata) { + HASH_FIND_STR(uniqueNS, rdata, ns); + + if (!ns) { + ns = malloc(sizeof(struct my_struct)); + ns->domain = strdup(rdata); + HASH_ADD_STR(uniqueNS, domain, ns); + } } }