CID 1442835: Integer Overflow
authorPauli <paul.dale@oracle.com>
Sun, 24 Feb 2019 11:26:39 +0000 (21:26 +1000)
committerPauli <paul.dale@oracle.com>
Sun, 24 Feb 2019 11:26:39 +0000 (21:26 +1000)
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/8318)

crypto/property/property_parse.c

index 2094d38e8803f3e25761a30fc58210dcf57a4f04..074da51c6b6cb50f0b0bbd16baee019904040139 100644 (file)
@@ -301,7 +301,7 @@ static OSSL_PROPERTY_LIST *stack_to_property_list(STACK_OF(PROPERTY_DEFINITION)
     int i;
 
     r = OPENSSL_malloc(sizeof(*r)
-                       + (n == 0 ? 0 : n - 1) * sizeof(r->properties[0]));
+                       + (n <= 0 ? 0 : n - 1) * sizeof(r->properties[0]));
     if (r != NULL) {
         sk_PROPERTY_DEFINITION_sort(sk);