aboutsummaryrefslogtreecommitdiffhomepage
path: root/projects/gnupg
diff options
context:
space:
mode:
authorGravatar Catena cyber <35799796+catenacyber@users.noreply.github.com>2019-10-17 21:14:18 +0200
committerGravatar jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com>2019-10-17 12:14:18 -0700
commit802224497df3452709a3219eb949780879dc6061 (patch)
tree6ba92eacd7c630f99a2f9cdfc5f5c61dca87ab2e /projects/gnupg
parente612b88c67befee843338e13f734fb6426a0e054 (diff)
[gnupg] Limit size for gnupg decrypt target (#2962)
Diffstat (limited to 'projects/gnupg')
-rw-r--r--projects/gnupg/fuzz_decrypt.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/projects/gnupg/fuzz_decrypt.c b/projects/gnupg/fuzz_decrypt.c
index 744f68e9..ebc7d7d4 100644
--- a/projects/gnupg/fuzz_decrypt.c
+++ b/projects/gnupg/fuzz_decrypt.c
@@ -71,6 +71,9 @@ static void rmrfdir(char *path)
}
}
+// 65kb should be enough ;-)
+#define MAX_LEN 0x10000
+
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
if (! initialized) {
@@ -124,6 +127,10 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
memset(ctrlGlobal, 0, sizeof(*ctrlGlobal));
ctrlGlobal->magic = SERVER_CONTROL_MAGIC;
+ if (Size > MAX_LEN) {
+ // limit maximum size to avoid long computing times
+ Size = MAX_LEN;
+ }
if (ftruncate(fd, Size) == -1) {
return 0;