Avoid the call to OPENSSL_malloc with a negative value (then casted to unsigned)
[openssl.git] / crypto / dso / dso_lib.c
index 8f185b38283cdd870c3a8b9374175712ba3c95db..ec3c59ac4d222293dbd0cf5412c1e81f2bf85e28 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)