| 70 | } |
| 71 | |
| 72 | void run(const uint8_t *data, size_t size) |
| 73 | { |
| 74 | struct daemon *daemon = NULL; |
| 75 | struct peer *peer; |
| 76 | struct pubkey dummy_key; |
| 77 | |
| 78 | if (setjmp(fuzz_env) != 0) |
| 79 | goto cleanup; |
| 80 | |
| 81 | memset(&dummy_key, 'c', sizeof(dummy_key)); |
| 82 | |
| 83 | daemon = new_daemon(tmpctx); |
| 84 | if (!daemon) |
| 85 | goto cleanup; |
| 86 | |
| 87 | peer = talz(tmpctx, struct peer); |
| 88 | |
| 89 | peer->daemon = daemon; |
| 90 | node_id_from_pubkey(&peer->id, &dummy_key); |
| 91 | peer->onionmsg_incoming_tokens = ONION_MSG_MSEC; |
| 92 | |
| 93 | /* Use fuzzer data as payload of the onion message. */ |
| 94 | const u8 *onion_msg = towire_onion_message(tmpctx, &dummy_key, |
| 95 | tal_dup_arr(tmpctx, u8, data, size, 0)); |
| 96 | |
| 97 | handle_onion_message(daemon, peer, onion_msg); |
| 98 | |
| 99 | cleanup: |
| 100 | if (daemon) |
| 101 | tal_free(daemon->master); |
| 102 | clean_tmpctx(); |
| 103 | } |
nothing calls this directly
no test coverage detected