Avoid the call to OPENSSL_malloc with a negative value (then casted to unsigned)

CLA: trivial
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2021)
This commit is contained in:
Davide Galassi 2016-12-02 17:10:37 +01:00 committed by Rich Salz
parent eb43101ff8
commit 210fe4edee

View File

@ -324,6 +324,9 @@ DSO *DSO_dsobyaddr(void *addr, int flags)
char *filename = NULL;
int len = DSO_pathbyaddr(addr, NULL, 0);
if (len < 0)
return NULL;
filename = OPENSSL_malloc(len);
if (filename != NULL
&& DSO_pathbyaddr(addr, filename, len) == len)