summaryrefslogtreecommitdiffstats
path: root/crypto/bio
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2022-09-20 16:48:59 +0200
committerHugo Landau <hlandau@openssl.org>2022-09-23 14:27:14 +0100
commitc6be0aa8ac3c172ad998ce33f392143312bfe760 (patch)
treef7527c328b78cdb6afc9a0667fa428cd7b0d7533 /crypto/bio
parente9809f8a09147bc27f974caa908b04439c006625 (diff)
Maximum return value of BIO_ctrl_(w)pending is SIZE_MAX
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.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/crypto/bio/bio_lib.c b/crypto/bio/bio_lib.c
index 8a8c1f34f7..1a76c054d4 100644
--- a/crypto/bio/bio_lib.c
+++ b/crypto/bio/bio_lib.c
@@ -12,6 +12,7 @@
#include <stdio.h>
#include <errno.h>
#include <openssl/crypto.h>
+#include "internal/numbers.h"
#include "bio_local.h"
/*
@@ -718,6 +719,10 @@ size_t BIO_ctrl_pending(BIO *bio)
if (ret < 0)
ret = 0;
+#if LONG_MAX > SIZE_MAX
+ if (ret > SIZE_MAX)
+ ret = SIZE_MAX;
+#endif
return (size_t)ret;
}
@@ -727,6 +732,10 @@ size_t BIO_ctrl_wpending(BIO *bio)
if (ret < 0)
ret = 0;
+#if LONG_MAX > SIZE_MAX
+ if (ret > SIZE_MAX)
+ ret = SIZE_MAX;
+#endif
return (size_t)ret;
}