From ae9330b64181e32feb4f2e278a38afd6f4c77609 Mon Sep 17 00:00:00 2001 From: Aram Sargsyan Date: Fri, 3 Sep 2021 00:59:57 +0000 Subject: [PATCH] Fix an off-by-one error in catz_opt_cmp() function 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 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/dns/catz.c b/lib/dns/catz.c index 3f60afaf35..f946d9dab6 100644 --- a/lib/dns/catz.c +++ b/lib/dns/catz.c @@ -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);