summaryrefslogtreecommitdiffstats
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:41:59 -0500
commit210fe4edee6514e4c1f0677adc9112c4459da02b (patch)
tree386087e8793f5d6d322bd55606b38f4d175c22e0
parenteb43101ff8c5c75d1ddf8b90de41d03cea1b0909 (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)
-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 8f185b3828..ec3c59ac4d 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)