diff options
author | Catena cyber <35799796+catenacyber@users.noreply.github.com> | 2019-10-17 21:14:18 +0200 |
---|---|---|
committer | jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com> | 2019-10-17 12:14:18 -0700 |
commit | 802224497df3452709a3219eb949780879dc6061 (patch) | |
tree | 6ba92eacd7c630f99a2f9cdfc5f5c61dca87ab2e /projects/gnupg | |
parent | e612b88c67befee843338e13f734fb6426a0e054 (diff) |
[gnupg] Limit size for gnupg decrypt target (#2962)
Diffstat (limited to 'projects/gnupg')
-rw-r--r-- | projects/gnupg/fuzz_decrypt.c | 7 |
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; |