FreeRDP
Loading...
Searching...
No Matches
TestFuzzLsaProto.c
1
21
22#include <stddef.h>
23#include <stdint.h>
24#include <stdlib.h>
25
26#include <winpr/crt.h>
27#include <winpr/stream.h>
28
29#include "../lsa_proto.h"
30
31int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size);
32
33int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
34{
35 wStream buffer = WINPR_C_ARRAY_INIT;
36 wStream* s = Stream_StaticConstInit(&buffer, data, size);
37 if (!s)
38 return 0;
39
40 LsaProtoReader reader = WINPR_C_ARRAY_INIT;
41 LSA_MSG_HDR hdr = WINPR_C_ARRAY_INIT;
42 if (lsa_proto_reader_init(&reader, s, &hdr))
43 {
44 UINT16 u16 = 0;
45 UINT32 u32 = 0;
46 UINT64 u64 = 0;
47 BYTE* blob = nullptr;
48 UINT32 blen = 0;
49
50 (void)lsa_proto_read_u16(&reader, &u16);
51 (void)lsa_proto_read_u32(&reader, &u32);
52 (void)lsa_proto_read_u64(&reader, &u64);
53 if (lsa_proto_read_blob(&reader, &blob, &blen))
54 free(blob);
55
56 lsa_proto_reader_done(&reader);
57 }
58
59 return 0;
60}