diff --git a/ccan/ccan/json_out/json_out.c b/ccan/ccan/json_out/json_out.c index 53837e67c33a..5f497df63bdd 100644 --- a/ccan/ccan/json_out/json_out.c +++ b/ccan/ccan/json_out/json_out.c @@ -9,7 +9,7 @@ struct json_out { /* Callback if we reallocate. */ void (*move_cb)(struct json_out *jout, ptrdiff_t delta, void *arg); void *cb_arg; - + #ifdef CCAN_JSON_OUT_DEBUG /* tal_arr of types ( or [ we're enclosed in. NULL if oom. */ char *wrapping; @@ -246,7 +246,7 @@ bool json_out_addv(struct json_out *jout, dst = mkroom(jout, fmtlen + 1 + (int)quote*2); if (!dst) goto out; - vsprintf(dst + quote, fmt, ap2); + vsnprintf(dst + quote, fmtlen + 1, fmt, ap2); } #ifdef CCAN_JSON_OUT_DEBUG diff --git a/common/test/run-trace.c b/common/test/run-trace.c index 7811f68c91dd..e257d445a6d5 100644 --- a/common/test/run-trace.c +++ b/common/test/run-trace.c @@ -8,7 +8,7 @@ int main(int argx, char *argv[]) { /* Just some context objects to hang spans off of. */ - int a, b, c, d; + int a = 0, b = 0, c = 0, d = 0; common_setup(argv[0]); diff --git a/devtools/mkquery.c b/devtools/mkquery.c index 9fe6e69f858c..d75075121f81 100644 --- a/devtools/mkquery.c +++ b/devtools/mkquery.c @@ -17,7 +17,7 @@ int main(int argc, char *argv[]) { struct bitcoin_blkid chainhash; const tal_t *ctx = tal(NULL, char); - const u8 *msg; + const u8 *msg = NULL; setup_locale(); secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY | @@ -36,7 +36,7 @@ int main(int argc, char *argv[]) strtol(argv[3], NULL, 0), strtol(argv[4], NULL, 0)); } else if (streq(argv[1], "query_channel_range")) { - struct tlv_query_channel_range_tlvs *tlvs; + struct tlv_query_channel_range_tlvs *tlvs = NULL; if (argc == 5) tlvs = NULL; else if (argc == 6) { @@ -50,7 +50,7 @@ int main(int argc, char *argv[]) strtol(argv[4], NULL, 0), tlvs); } else if (streq(argv[1], "query_short_channel_ids")) { - struct tlv_query_short_channel_ids_tlvs *tlvs; + struct tlv_query_short_channel_ids_tlvs *tlvs = NULL; u8 *encoded; if (argc == 4) diff --git a/lightningd/dual_open_control.c b/lightningd/dual_open_control.c index 388ba47e748d..42eac1c17589 100644 --- a/lightningd/dual_open_control.c +++ b/lightningd/dual_open_control.c @@ -2254,7 +2254,7 @@ static bool verify_option_will_fund_signature(struct peer *peer, static void handle_validate_lease(struct subd *dualopend, const u8 *msg) { - const secp256k1_ecdsa_signature sig; + secp256k1_ecdsa_signature sig = {{0}}; u16 chan_fee_max_ppt; u32 chan_fee_max_base_msat, lease_expiry; struct pubkey their_pubkey; diff --git a/openingd/dualopend.c b/openingd/dualopend.c index f03f1b927b1d..2b3ff44bf8e2 100644 --- a/openingd/dualopend.c +++ b/openingd/dualopend.c @@ -2794,7 +2794,6 @@ static u8 *opener_commits(struct state *state, struct amount_sat total, char **err_reason) { - struct channel_id cid; struct amount_msat our_msats; struct penalty_base *pbase; struct bitcoin_tx *local_commit; @@ -2853,7 +2852,7 @@ static u8 *opener_commits(struct state *state, tal_free(state->channel); state->channel = new_initial_channel(state, - &cid, + &state->channel_id, &tx_state->funding, state->minimum_depth, take(new_height_states(NULL, LOCAL,