Merge pull request #1 from JacobBarthelmeh/limit-file-size

add check for input size
pull/2/head
toddouska 2018-04-26 13:31:41 -07:00 committed by GitHub
commit bb890177b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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());