]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
params: emit an error if a parameter array overflows
authorPauli <ppzgs1@gmail.com>
Thu, 17 Jul 2025 01:13:56 +0000 (11:13 +1000)
committerTomas Mraz <tomas@openssl.org>
Thu, 31 Jul 2025 18:21:25 +0000 (20:21 +0200)
This is in addition to returning an error code.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27923)

util/perl/OpenSSL/paramnames.pm

index 76efdd1f9435e7234dcce60df6e660d3e2cb0aff..1d0dbdf70e53380a454809f6852b1173ae732921 100644 (file)
@@ -653,8 +653,11 @@ sub trie_matched {
   my $indent2 = shift;
 
   if (defined($num)) {
-    printf "%sif (ossl_unlikely(r->num_%s >= %s))\n", $indent1, $field, $num;
+    printf "%sif (ossl_unlikely(r->num_%s >= %s)) {\n", $indent1, $field, $num;
+    printf "%sERR_raise_data(ERR_LIB_PROV, PROV_R_TOO_MANY_RECORDS,\n", $indent2;
+    printf "%s               \"param %%s present >%%d times\", s, $num);\n", $indent2;
     printf "%sreturn 0;\n", $indent2;
+    printf "%s}\n", $indent1;
     printf "%sr->%s[r->num_%s++] = (OSSL_PARAM *)p;\n", $indent1, $field, $field;
   } else {
     printf "%sif (ossl_likely(r->%s == NULL))\n", $indent1, $field;