add check for input size

pull/1/head
Jacob Barthelmeh 2018-04-16 16:45:34 -06:00
parent 7c10e1adc4
commit f48c4d808b
1 changed files with 7 additions and 0 deletions

View File

@ -25,6 +25,8 @@
#include <wolfssl/options.h>
#include <wolfssl/ssl.h>
#define WC_MAX_FUZZ_INPUT_SZ 25000
/* testing wolfSSL_CTX_use_certificate_buffer with PEM as the filetype*/
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t sz)
@ -32,6 +34,11 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t sz)
WOLFSSL_CTX *ctx;
int ret;
/* avoid 25s timeout with parsing large files */
if (sz > WS_MAX_FUZZ_INPUT_SZ) {
return 0;
}
wolfSSL_Init();
ctx = wolfSSL_CTX_new(wolfTLSv1_2_server_method());