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)
This commit is contained in:
Tomas Mraz 2022-09-20 16:48:59 +02:00 committed by Hugo Landau
parent e9809f8a09
commit c6be0aa8ac

View File

@ -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;
}