Check a return value for success in ec_field_size()
authorMatt Caswell <matt@openssl.org>
Tue, 26 Jun 2018 14:12:56 +0000 (15:12 +0100)
committerMatt Caswell <matt@openssl.org>
Sat, 7 Jul 2018 13:00:19 +0000 (14:00 +0100)
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6592)

crypto/sm2/sm2_crypt.c

index f2470609f9f14ea6b8b70271b66f8e58fc01a03b..aedf9054c1cf08a4b739011d38e40ae568d39977 100644 (file)
@@ -48,7 +48,8 @@ static size_t ec_field_size(const EC_GROUP *group)
     if (p == NULL || a == NULL || b == NULL)
        goto done;
 
     if (p == NULL || a == NULL || b == NULL)
        goto done;
 
-    EC_GROUP_get_curve_GFp(group, p, a, b, NULL);
+    if (!EC_GROUP_get_curve_GFp(group, p, a, b, NULL))
+        goto done;
     field_size = (BN_num_bits(p) + 7) / 8;
 
  done:
     field_size = (BN_num_bits(p) + 7) / 8;
 
  done: