From 9d40a165a0672326558c8d0bb09df7bed53d15a9 Mon Sep 17 00:00:00 2001 From: Peter Neuroth Date: Fri, 24 Nov 2023 16:51:30 +0100 Subject: [PATCH] hsmtool: Fix argc check on getcodexsecret This caused a segmentation fault when calling `getcodexsecret` without id. Signed-off-by: Peter Neuroth Changelog-Fixed: Hsmtool: Fix segmentation fault when calling `getcodexsecret` without id. --- tools/hsmtool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/hsmtool.c b/tools/hsmtool.c index b0f321087..b9bcad195 100644 --- a/tools/hsmtool.c +++ b/tools/hsmtool.c @@ -47,7 +47,7 @@ static void show_usage(const char *progname) printf(" - dumponchaindescriptors [network]\n"); printf(" - makerune \n"); printf(" - getcodexsecret \n"); - printf(" - getemergencyrecover \n"); + printf(" - getemergencyrecover \n"); exit(0); } @@ -788,7 +788,7 @@ int main(int argc, char *argv[]) } if(streq(method, "getcodexsecret")) { - if (argc < 2) + if (argc < 4) show_usage(argv[0]); return make_codexsecret(argv[2], argv[3]); }