Terminate DS-search when reaching the root via cache entries.
diff --git a/src/forward.c b/src/forward.c
index d9a41ba..7a87cb3 100644
--- a/src/forward.c
+++ b/src/forward.c
@@ -1328,6 +1328,10 @@
continue;
}
+ /* Reached the root */
+ if (!name_start)
+ return STAT_BOGUS;
+
strcpy(keyname, name_start);
return STAT_NEED_DS_NEG;
}
@@ -1412,6 +1416,13 @@
continue;
}
+ /* reached the root */
+ if (!name_start)
+ {
+ free(packet);
+ return STAT_BOGUS;
+ }
+
m = dnssec_generate_query(header, ((char *) header) + 65536, name_start, class, T_DS, &server->addr);
/* We rely on the question section coming back unchanged, ensure it is with the hash. */