mirror of
https://github.com/openssl/openssl.git
synced 2025-01-18 13:44:20 +08:00
coverity 1414446 out-of-bounds access: allocate \0 terminator byte to be safe
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13091)
This commit is contained in:
parent
19431e5e44
commit
fb33f99409
@ -289,10 +289,10 @@ static int run_cert(X509 *crt, const char *nameincert,
|
||||
for (; *pname != NULL; ++pname) {
|
||||
int samename = strcasecmp(nameincert, *pname) == 0;
|
||||
size_t namelen = strlen(*pname);
|
||||
char *name = OPENSSL_malloc(namelen);
|
||||
char *name = OPENSSL_malloc(namelen + 1);
|
||||
int match, ret;
|
||||
|
||||
memcpy(name, *pname, namelen);
|
||||
memcpy(name, *pname, namelen + 1);
|
||||
|
||||
match = -1;
|
||||
if (!TEST_int_ge(ret = X509_check_host(crt, name, namelen, 0, NULL),
|
||||
|
Loading…
Reference in New Issue
Block a user