summaryrefslogtreecommitdiffstats
path: root/crypto/bio
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2022-09-19 10:36:21 +0200
committerHugo Landau <hlandau@openssl.org>2022-09-23 14:27:14 +0100
commite9809f8a09147bc27f974caa908b04439c006625 (patch)
tree9548341ec682f686167385f770876fbc525177a3 /crypto/bio
parent538ee4e0977492009f8ca39d577d8a1aeb8d27fd (diff)
Fix error return values from BIO_ctrl_(w)pending()
Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19240)
Diffstat (limited to 'crypto/bio')
-rw-r--r--crypto/bio/bio_lib.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/crypto/bio/bio_lib.c b/crypto/bio/bio_lib.c
index f6d40b2d1c..8a8c1f34f7 100644
--- a/crypto/bio/bio_lib.c
+++ b/crypto/bio/bio_lib.c
@@ -714,12 +714,20 @@ long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)
*/
size_t BIO_ctrl_pending(BIO *bio)
{
- return BIO_ctrl(bio, BIO_CTRL_PENDING, 0, NULL);
+ long ret = BIO_ctrl(bio, BIO_CTRL_PENDING, 0, NULL);
+
+ if (ret < 0)
+ ret = 0;
+ return (size_t)ret;
}
size_t BIO_ctrl_wpending(BIO *bio)
{
- return BIO_ctrl(bio, BIO_CTRL_WPENDING, 0, NULL);
+ long ret = BIO_ctrl(bio, BIO_CTRL_WPENDING, 0, NULL);
+
+ if (ret < 0)
+ ret = 0;
+ return (size_t)ret;
}
/* put the 'bio' on the end of b's list of operators */