record header fuzz
This commit is contained in:
parent
58caf70dc9
commit
a18602951b
@ -935,7 +935,8 @@ enum fuzzer_type {
|
||||
FUZZ_HMAC = 0,
|
||||
FUZZ_ENCRYPT = 1,
|
||||
FUZZ_SIGNATURE = 2,
|
||||
FUZZ_HASH = 3
|
||||
FUZZ_HASH = 3,
|
||||
FUZZ_HEAD = 4
|
||||
};
|
||||
|
||||
typedef int (*CallbackFuzzer)(const unsigned char* buf, int sz, int type,
|
||||
|
@ -2959,6 +2959,11 @@ static int GetRecordHeader(CYASSL* ssl, const byte* input, word32* inOutIdx,
|
||||
RecordLayerHeader* rh, word16 *size)
|
||||
{
|
||||
if (!ssl->options.dtls) {
|
||||
#ifdef HAVE_FUZZER
|
||||
if (ssl->fuzzerCb)
|
||||
ssl->fuzzerCb(input + *inOutIdx, RECORD_HEADER_SZ, FUZZ_HEAD,
|
||||
ssl->ctx);
|
||||
#endif
|
||||
XMEMCPY(rh, input + *inOutIdx, RECORD_HEADER_SZ);
|
||||
*inOutIdx += RECORD_HEADER_SZ;
|
||||
ato16(rh->length, size);
|
||||
@ -2974,6 +2979,12 @@ static int GetRecordHeader(CYASSL* ssl, const byte* input, word32* inOutIdx,
|
||||
*inOutIdx += 4; /* advance past rest of seq */
|
||||
ato16(input + *inOutIdx, size);
|
||||
*inOutIdx += LENGTH_SZ;
|
||||
#ifdef HAVE_FUZZER
|
||||
if (ssl->fuzzerCb)
|
||||
ssl->fuzzerCb(input + *inOutIdx - LENGTH_SZ - 8 - ENUM_LEN -
|
||||
VERSION_SZ, ENUM_LEN + VERSION_SZ + 8 + LENGTH_SZ,
|
||||
FUZZ_HEAD, ssl->ctx);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user