]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Properly check test-syncplugin skip label for equality
authorMark Andrews <marka@isc.org>
Wed, 8 Jul 2026 02:08:38 +0000 (12:08 +1000)
committerMark Andrews <marka@isc.org>
Tue, 14 Jul 2026 22:02:33 +0000 (08:02 +1000)
The label length and the string length where not being checked so
a label that started with a string that matched the skip label would
incorrectly match.

bin/tests/system/hooks/driver/test-syncplugin.c

index 3ac08a2dc99e310768afb2b6a440ca27859094e7..ef85ef4b8332f292cda452bcfebacc24a88dcc1e 100644 (file)
@@ -38,6 +38,7 @@ syncplugin__hook(void *arg, void *cbdata, isc_result_t *resp) {
        if (inst->firstlbl != NULL) {
                const dns_name_t *qname = qctx->client->query.qname;
                dns_label_t label;
+               size_t len = strlen(inst->firstlbl);
 
                dns_name_getlabel(qname, 0, &label);
 
@@ -45,8 +46,8 @@ syncplugin__hook(void *arg, void *cbdata, isc_result_t *resp) {
                 * +1 because the first label byte is the length of the label
                 * itself
                 */
-               if (strncmp(inst->firstlbl, (char *)label.base + 1,
-                           strlen(inst->firstlbl)) == 0)
+               if (*label.base == len &&
+                   strncmp(inst->firstlbl, (char *)label.base + 1, len) == 0)
                {
                        return NS_HOOK_CONTINUE;
                }