]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: jws: Add missing return value check (EVP_PKEY_get_bn_param)
authorRemi Tricot-Le Breton <rlebreton@haproxy.com>
Tue, 19 May 2026 13:00:23 +0000 (15:00 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 19 May 2026 13:21:26 +0000 (15:21 +0200)
Two calls of 'EVP_PKEY_get_bn_param' did not have their return value
checked.

This patch can be backported up to 3.2.

src/jws.c

index ae94fc3ca0c871de8592ecc0ee51b8f2819df229..769a74b1e54dced4bd0156360d895e4f330c41f8 100644 (file)
--- a/src/jws.c
+++ b/src/jws.c
@@ -59,8 +59,10 @@ static size_t EVP_PKEY_EC_to_pub_jwk(EVP_PKEY *pkey, char *dst, size_t dsize)
        size_t curvelen;
        int nid;
 
-       EVP_PKEY_get_bn_param(pkey, OSSL_PKEY_PARAM_EC_PUB_X, &x);
-       EVP_PKEY_get_bn_param(pkey, OSSL_PKEY_PARAM_EC_PUB_Y, &y);
+       if (EVP_PKEY_get_bn_param(pkey, OSSL_PKEY_PARAM_EC_PUB_X, &x) == 0)
+               goto out;
+       if (EVP_PKEY_get_bn_param(pkey, OSSL_PKEY_PARAM_EC_PUB_Y, &y) == 0)
+               goto out;
 
        if (EVP_PKEY_get_utf8_string_param(pkey, OSSL_PKEY_PARAM_GROUP_NAME, curve, sizeof(curve), &curvelen) == 0)
                goto out;