summaryrefslogtreecommitdiffstats
path: root/test/cmsapitest.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/cmsapitest.c')
-rw-r--r--test/cmsapitest.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/cmsapitest.c b/test/cmsapitest.c
index 5839eb7431..59dd7faeb2 100644
--- a/test/cmsapitest.c
+++ b/test/cmsapitest.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2018-2024 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -332,6 +332,9 @@ static unsigned char *read_all(BIO *bio, long *p_len)
if (ret < 0)
break;
+ if (LONG_MAX - ret < *p_len)
+ break;
+
*p_len += ret;
if (ret < step)