summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Salzman <daniel.salzman@nic.cz>2024-11-13 09:29:32 +0100
committerDaniel Salzman <daniel.salzman@nic.cz>2024-11-14 09:09:04 +0100
commit7f5bfb47d75af4d72c509523d894ce014bc3a886 (patch)
tree776b7ca9aa91a8323df94497204d9e4f12012359
parentnameserver: use ssize_t instead of size_t to ensure correct condition evaluation (diff)
downloadknot-7f5bfb47d75af4d72c509523d894ce014bc3a886.tar.xz
knot-7f5bfb47d75af4d72c509523d894ce014bc3a886.zip
nameserver: add sanity assert to get_next_closer()
-rw-r--r--src/knot/nameserver/nsec_proofs.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/knot/nameserver/nsec_proofs.c b/src/knot/nameserver/nsec_proofs.c
index 5888b0513..c99fd1fcb 100644
--- a/src/knot/nameserver/nsec_proofs.c
+++ b/src/knot/nameserver/nsec_proofs.c
@@ -120,6 +120,7 @@ static const knot_dname_t *get_next_closer(const knot_dname_t *closest_encloser,
// make name only one label longer than closest_encloser
ssize_t ce_labels = knot_dname_labels(closest_encloser, NULL);
ssize_t qname_labels = knot_dname_labels(name, NULL);
+ assert(qname_labels > ce_labels);
for (int i = 0; i < (qname_labels - ce_labels - 1); ++i) {
name = knot_dname_next_label(name);
}