Limits input size for gnupg list fuzz target (#2987)

This commit is contained in:
Catena cyber 2019-10-29 14:58:12 +01:00 committed by jonathanmetzman
parent fd56d723bb
commit f03d6345d4
1 changed files with 8 additions and 0 deletions

View File

@ -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) {
IOBUF a;
armor_filter_context_t *afx = NULL;
@ -132,6 +135,11 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
initialized = true;
}
if (Size > MAX_LEN) {
// limit maximum size to avoid long computing times
Size = MAX_LEN;
}
memset(ctrlGlobal, 0, sizeof(*ctrlGlobal));
ctrlGlobal->magic = SERVER_CONTROL_MAGIC;