diff options
author | Daiki Ueno <ueno@gnu.org> | 2021-03-29 11:06:37 +0200 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2021-03-29 13:09:23 +0200 |
commit | f79af112029d3146d8b1926561ed5834e95c6666 (patch) | |
tree | 3ea51fc1d71d6905e587e3d4e05ed287a8e4005b /lib/pkcs11.c | |
parent | 584783a3fc2048ca6673ccdc4f44d0ffc46080cb (diff) | |
download | gnutls-f79af112029d3146d8b1926561ed5834e95c6666.tar.gz |
build: avoid integer overflow in additions
Signed-off-by: Daiki Ueno <ueno@gnu.org>
Diffstat (limited to 'lib/pkcs11.c')
-rw-r--r-- | lib/pkcs11.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/pkcs11.c b/lib/pkcs11.c index 7e8c0570ac..364c0c49a9 100644 --- a/lib/pkcs11.c +++ b/lib/pkcs11.c @@ -40,6 +40,7 @@ #include "x509/x509_int.h" #include <atfork.h> +#include "intprops.h" #define MAX_PROVIDERS 16 @@ -3291,6 +3292,11 @@ find_multi_objs_cb(struct ck_function_list *module, struct pkcs11_session_info * unsigned j; gnutls_datum_t id; + if (unlikely(INT_ADD_OVERFLOW(find_data->current, count))) { + ret = gnutls_assert_val(GNUTLS_E_MEMORY_ERROR); + goto fail; + } + find_data->p_list = _gnutls_reallocarray_fast(find_data->p_list, find_data->current + count, |