[openssl-commits] [openssl] OpenSSL_1_0_2-stable update

Rich Salz rsalz at openssl.org
Wed Feb 22 18:16:21 UTC 2017


The branch OpenSSL_1_0_2-stable has been updated
       via  ea63fdda830b883314e163283e90db66ec3b7876 (commit)
      from  90670b54c493c04c830ac38e9cfd7acf8fac4012 (commit)


- Log -----------------------------------------------------------------
commit ea63fdda830b883314e163283e90db66ec3b7876
Author: Rich Salz <rsalz at openssl.org>
Date:   Wed Feb 22 13:11:08 2017 -0500

    Iterate over EC_GROUP's poly array in a safe way
    
    Prevent that memory beyond the last element is accessed if every element
    of group->poly[] is non-zero
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/2689)
    
    (cherry picked from commit 57f48f939ed5d3119e3c691ea0a8a3ac2f4a1a9e)

-----------------------------------------------------------------------

Summary of changes:
 crypto/ec/ec_asn1.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/crypto/ec/ec_asn1.c b/crypto/ec/ec_asn1.c
index 33abf61..e3295c4 100644
--- a/crypto/ec/ec_asn1.c
+++ b/crypto/ec/ec_asn1.c
@@ -64,15 +64,18 @@
 
 int EC_GROUP_get_basis_type(const EC_GROUP *group)
 {
-    int i = 0;
+    int i;
 
     if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) !=
         NID_X9_62_characteristic_two_field)
         /* everything else is currently not supported */
         return 0;
 
-    while (group->poly[i] != 0)
-        i++;
+    /* Find the last non-zero element of group->poly[] */
+    for (i = 0;
+         i < (int)OSSL_NELEM(group->poly) & group->poly[i] != 0;
+         i++)
+        continue;
 
     if (i == 4)
         return NID_X9_62_ppBasis;


More information about the openssl-commits mailing list