MCPcopy Create free account
hub / github.com/ElementsProject/lightning / run

Function run

tests/fuzz/fuzz-wireaddr.c:20–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18}
19
20void run(const uint8_t *data, size_t size)
21{
22 char *addr = to_string(tmpctx, data, size);
23
24 struct wireaddr wa, decoded_wa;
25 const char *err;
26
27 err = parse_wireaddr(tmpctx, addr, DEFAULT_PORT, NULL, &wa);
28
29 if (!err) {
30 assert(fmt_wireaddr(tmpctx, &wa));
31
32 u8 *output_buffer = tal_arr(tmpctx, u8, 0);
33 towire_wireaddr(&output_buffer, &wa);
34 size_t len = tal_bytelen(output_buffer);
35
36 assert(fromwire_wireaddr((const u8 **)&output_buffer, &len,
37 &decoded_wa) == FROMWIREADDR_OK);
38 assert(wireaddr_eq(&wa, &decoded_wa));
39 }
40
41 clean_tmpctx();
42}

Callers

nothing calls this directly

Calls 8

parse_wireaddrFunction · 0.85
fmt_wireaddrFunction · 0.85
towire_wireaddrFunction · 0.85
tal_bytelenFunction · 0.85
fromwire_wireaddrFunction · 0.85
wireaddr_eqFunction · 0.85
clean_tmpctxFunction · 0.85
to_stringFunction · 0.70

Tested by

no test coverage detected