Skip to content

Commit e81bf8b

Browse files
morehousecdecker
authored andcommitted
devtools: call common_setup in main
Fixes nullability errors detected by UBSan: wire/fromwire.c:173:46: runtime error: null pointer passed as argument 1, which is declared to never be null external/libwally-core/src/secp256k1/include/secp256k1.h:432:3: note: nonnull attribute specified here #0 0x65214a in fromwire_secp256k1_ecdsa_signature wire/fromwire.c:173:6 #1 0x659500 in printwire_secp256k1_ecdsa_signature devtools/print_wire.c:331:1 #2 0x646ba2 in printwire_channel_update wire/peer_printgen.c:1900:7 #3 0x637182 in printpeer_wire_message wire/peer_printgen.c:128:11 #4 0x65a097 in main devtools/decodemsg.c:85:10
1 parent 3edb092 commit e81bf8b

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

devtools/decodemsg.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <ccan/err/err.h>
33
#include <ccan/opt/opt.h>
44
#include <ccan/tal/grab_file/grab_file.h>
5+
#include <common/setup.h>
56
#include <unistd.h>
67
#include <wire/onion_printgen.h>
78
#include <wire/peer_printgen.h>
@@ -50,6 +51,7 @@ int main(int argc, char *argv[])
5051
bool (*printwire)(const u8 *msg) = printpeer_wire_message;
5152
bool ok = true;
5253

54+
common_setup(argv[0]);
5355
setup_locale();
5456

5557
opt_register_noarg("--onion", opt_set_onionprint, &printwire,

devtools/route.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <common/dijkstra.h>
66
#include <common/gossmap.h>
77
#include <common/route.h>
8+
#include <common/setup.h>
89
#include <common/type_to_string.h>
910
#include <devtools/clean_topo.h>
1011
#include <inttypes.h>
@@ -70,6 +71,8 @@ int main(int argc, char *argv[])
7071
bool clean_topology = false;
7172
size_t num_channel_updates_rejected;
7273

74+
common_setup(argv[0]);
75+
7376
opt_register_noarg("--clean-topology", opt_set_bool, &clean_topology,
7477
"Clean up topology before run");
7578
opt_register_noarg("-h|--help", opt_usage_and_exit,

0 commit comments

Comments
 (0)