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:41:59 +0000 (16:41 -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)

crypto/dso/dso_lib.c

index 8f185b3..ec3c59a 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)