sslSNICallback: Properly disallow invalid characters
Completely discard hostnames containing invalid characters, instead of merely replacing the invalid characters with uninitialized memory. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
parent
db4137c890
commit
3115eb4995
1 changed files with 2 additions and 6 deletions
|
@ -572,18 +572,14 @@ static int sslSNICallback(SSL *sslHndl, int *al ATTR_UNUSED,
|
|||
} else if (ch != '\000' && ch != '.' && ch != '-' &&
|
||||
(ch < '0' ||(ch > '9' && ch < 'A') || (ch > 'Z' &&
|
||||
ch < 'a')|| ch > 'z')) {
|
||||
i++;
|
||||
continue;
|
||||
free(serverName);
|
||||
return SSL_TLSEXT_ERR_OK;
|
||||
}
|
||||
serverName[++i] = ch;
|
||||
if (!ch) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!*serverName) {
|
||||
free(serverName);
|
||||
return SSL_TLSEXT_ERR_OK;
|
||||
}
|
||||
SSL_CTX *context = (SSL_CTX *)getFromTrie(&ssl->sniContexts,
|
||||
serverName+1,
|
||||
NULL);
|
||||
|
|
Loading…
Reference in a new issue