MCPcopy Create free account
hub / github.com/git/git / host_matches

Function host_matches

imap-send.c:222–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220#else
221
222static int host_matches(const char *host, const ASN1_STRING *asn1_str)
223{
224 const char *pattern = (const char *)ASN1_STRING_get0_data(asn1_str);
225
226 /* embedded NUL characters may open a security hole */
227 if (memchr(pattern, '\0', ASN1_STRING_length(asn1_str)))
228 return 0;
229
230 if (pattern[0] == '*' && pattern[1] == '.') {
231 pattern += 2;
232 if (!(host = strchr(host, '.')))
233 return 0;
234 host++;
235 }
236
237 return *host && *pattern && !strcasecmp(host, pattern);
238}
239
240static int verify_hostname(X509 *cert, const char *hostname)
241{

Callers 1

verify_hostnameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected