]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix an off-by-one error in catz_opt_cmp() function
authorAram Sargsyan <aram@isc.org>
Fri, 3 Sep 2021 00:59:57 +0000 (00:59 +0000)
committerAram Sargsyan <aram@isc.org>
Thu, 9 Sep 2021 21:54:10 +0000 (21:54 +0000)
This commit fixes an off-by-one error in catz_opt_cmp() function which
was resulting in ignoring the last character of the compared string.

lib/dns/catz.c

index 3f60afaf35c87ab3c6c25ed359b0e76973c6251b..f946d9dab6d51450cdbfb1259851eec3cc1d6c1f 100644 (file)
@@ -886,9 +886,10 @@ typedef enum {
 
 static bool
 catz_opt_cmp(const dns_label_t *option, const char *opt) {
-       unsigned int l = strlen(opt);
-       if (option->length - 1 == l &&
-           memcmp(opt, option->base + 1, l - 1) == 0) {
+       size_t len = strlen(opt);
+
+       if (option->length - 1 == len &&
+           memcmp(opt, option->base + 1, len) == 0) {
                return (true);
        } else {
                return (false);