From e81bf8b89f77b4796315f8b734af757a68c3d9bf Mon Sep 17 00:00:00 2001 From: Matt Morehouse Date: Wed, 12 Apr 2023 15:27:46 -0500 Subject: [PATCH] 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 --- devtools/decodemsg.c | 2 ++ devtools/route.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/devtools/decodemsg.c b/devtools/decodemsg.c index d5bc708abfce..2a5d05c7efe9 100644 --- a/devtools/decodemsg.c +++ b/devtools/decodemsg.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -50,6 +51,7 @@ int main(int argc, char *argv[]) bool (*printwire)(const u8 *msg) = printpeer_wire_message; bool ok = true; + common_setup(argv[0]); setup_locale(); opt_register_noarg("--onion", opt_set_onionprint, &printwire, diff --git a/devtools/route.c b/devtools/route.c index ebf809301a72..30a87a26796a 100644 --- a/devtools/route.c +++ b/devtools/route.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -70,6 +71,8 @@ int main(int argc, char *argv[]) bool clean_topology = false; size_t num_channel_updates_rejected; + common_setup(argv[0]); + opt_register_noarg("--clean-topology", opt_set_bool, &clean_topology, "Clean up topology before run"); opt_register_noarg("-h|--help", opt_usage_and_exit,