Fixed buffer overrun (read only, usually harmless, but sloppy nonetheless).
[BearSSL] / src / ec / ecdsa_i31_vrfy_raw.c
index 54dcfc2..8af9597 100644 (file)
@@ -47,6 +47,13 @@ br_ecdsa_i31_vrfy_raw(const br_ec_impl *impl,
        size_t nlen, rlen, ulen;
        uint32_t n0i, res;
 
        size_t nlen, rlen, ulen;
        uint32_t n0i, res;
 
+       /*
+        * If the curve is not supported, then report an error.
+        */
+       if (((impl->supported_curves >> pk->curve) & 1) == 0) {
+               return 0;
+       }
+
        /*
         * Get the curve parameters (generator and order).
         */
        /*
         * Get the curve parameters (generator and order).
         */