summaryrefslogtreecommitdiffstats
path: root/crypto/dso/dso_lib.c
diff options
context:
space:
mode:
authorDavide Galassi <davide.galassi@gmail.com>2016-12-02 17:10:37 +0100
committerRich Salz <rsalz@openssl.org>2016-12-10 16:49:33 -0500
commita08ae8fee9539ed1432f4169cea46f6e27990dd5 (patch)
treed02b20937bd3b5c748177f25b5fcddc25fe15915 /crypto/dso/dso_lib.c
parenta3a4bb74cf4129b87739033d74623db5a5ec2ece (diff)
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) (cherry picked from commit 210fe4edee6514e4c1f0677adc9112c4459da02b)
Diffstat (limited to 'crypto/dso/dso_lib.c')
-rw-r--r--crypto/dso/dso_lib.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/dso/dso_lib.c b/crypto/dso/dso_lib.c
index 52816dfb9d..f58237d64b 100644
--- a/crypto/dso/dso_lib.c
+++ b/crypto/dso/dso_lib.c
@@ -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)