Avoid the call to OPENSSL_malloc with a negative value (then casted to unsigned)
authorDavide Galassi <davide.galassi@gmail.com>
Fri, 2 Dec 2016 16:10:37 +0000 (17:10 +0100)
committerRich Salz <rsalz@openssl.org>
Sat, 10 Dec 2016 21:49:33 +0000 (16:49 -0500)
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)

crypto/dso/dso_lib.c

index 52816dfb9d9812b618677acfe856f86346e1a8d3..f58237d64b7693eb62e70c64966cd0ce589b5cc4 100644 (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)