Skip to content

Commit

Permalink
Fix off-by-one in wildcard SAN checking
Browse files Browse the repository at this point in the history
Signed-off-by: DL6ER <[email protected]>
  • Loading branch information
DL6ER committed Feb 26, 2025
1 parent a0e4cc9 commit 0bd03ce
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 0bd03ce

Please sign in to comment.