Skip to content

Commit

Permalink
Merge pull request #2293 from pi-hole/fix/san_wildcard
Browse files Browse the repository at this point in the history
Fix off-by-one in wildcard SAN checking
  • Loading branch information
DL6ER authored Feb 27, 2025
2 parents 3158465 + 0bd03ce commit 0d8251b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/webserver/x509.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ static bool check_wildcard_domain(const char *domain, char *san, const size_t sa
// Attention: The SAN is not NUL-terminated, so we need to
// use the length field
const char *wild_domain = domain + domain_len - san_len + 1;
return strncasecmp(wild_domain, san + 1, san_len) == 0;
return strncasecmp(wild_domain, san + 1, san_len - 1) == 0;
}

// This function reads a X.509 certificate from a file and prints a
Expand Down

0 comments on commit 0d8251b

Please sign in to comment.