statzone

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

commit fba568b21b468f6fb4bcb0e54a308e0ab6c60c7b
parent 225eeba87f86d29db7fb42f41f8e5fd341bf6e6b
Author: Frederic Cambus <fred@statdns.com>
Date:   Thu, 21 Feb 2019 08:09:17 +0100

Check if domain and previousDomain lengths are different.

Calling strncmp with strlen(domain) as len paremeter will not produce the
desired result if domain happens to be a prefix of previousDomain.

Diffstat:
Msrc/statzone.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/statzone.c b/src/statzone.c @@ -171,7 +171,8 @@ main(int argc, char *argv[]) { if (!strcmp(token_lc, "ns")) { results.ns++; - if (strncmp(domain, previousDomain, strlen(domain))) { + if (strlen(previousDomain) != strlen(domain) || + strncmp(domain, previousDomain, strlen(domain))) { results.domains++; previousDomain = strdup(domain); if (!strncmp(domain, "xn--", 4))