Skip to content

Commit a7dad26

Browse files
committed
Wildcards should only be used in the first name component; fixed comment style
1 parent 9720d92 commit a7dad26

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ext/openssl/xp_ssl.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,12 @@ static zend_bool matches_wildcard_name(const char *subjectname, const char *cert
274274
return 1;
275275
}
276276

277-
if (!(wildcard = strchr(certname, '*'))) {
277+
/* wildcard, if present, must only be present in the left-most component */
278+
if (!(wildcard = strchr(certname, '*')) || memchr(certname, '.', wildcard - certname)) {
278279
return 0;
279280
}
280281

281-
// 1) prefix, if not empty, must match subject
282+
/* 1) prefix, if not empty, must match subject */
282283
prefix_len = wildcard - certname;
283284
if (prefix_len && strncasecmp(subjectname, certname, prefix_len) != 0) {
284285
return 0;

0 commit comments

Comments
 (0)