param build set: add errors to failure returns
[openssl.git] / crypto / param_build_set.c
index 8b570ded96ebb45379fc0aa097b784b5065185c3..75400eea9e123c4a962fad6f2688d63659426d46 100644 (file)
@@ -73,8 +73,10 @@ int ossl_param_build_set_bn_pad(OSSL_PARAM_BLD *bld, OSSL_PARAM *p,
         return OSSL_PARAM_BLD_push_BN_pad(bld, key, bn, sz);
     p = OSSL_PARAM_locate(p, key);
     if (p != NULL) {
-        if (sz > p->data_size)
+        if (sz > p->data_size) {
+            ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_TOO_SMALL_BUFFER);
             return 0;
+        }
         p->data_size = sz;
         return OSSL_PARAM_set_BN(p, bn);
     }