From 81cfd3799e44f23c65e3f34493c94576fa30c805 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 11 Jul 2023 01:53:43 +0930 Subject: [PATCH] lightningd: don't crash when we get a bogus estimatefees subfield. We hand "estimatefees.feerate_floor" as method, for example, and then crash instead of reporting the plugin which gave us the bad answer. Signed-off-by: Rusty Russell --- lightningd/bitcoind.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lightningd/bitcoind.c b/lightningd/bitcoind.c index 89b521955..fd2b19f71 100644 --- a/lightningd/bitcoind.c +++ b/lightningd/bitcoind.c @@ -113,9 +113,9 @@ static void bitcoin_plugin_error(struct bitcoind *bitcoind, const char *buf, reason = tal_vfmt(NULL, fmt, ap); va_end(ap); - p = strmap_get(&bitcoind->pluginsmap, method); + p = strmap_getn(&bitcoind->pluginsmap, method, strcspn(method, ".")); fatal("%s error: bad response to %s (%s), response was %.*s", - p->cmd, method, reason, + p ? p->cmd : "UNKNOWN CALL", method, reason, toks->end - toks->start, buf + toks->start); }