From dd34cccbea6e7b7f75dc6176f80a23424a4b1d56 Mon Sep 17 00:00:00 2001 From: lisa neigut Date: Wed, 11 Dec 2019 12:04:12 -0600 Subject: [PATCH] hsmtool: fixup miscount on params assuming argv is zero indexed, we should check that the argc count is at least as big as the desired args --- tools/hsmtool.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/hsmtool.c b/tools/hsmtool.c index 4048dd80d..f91686a5e 100644 --- a/tools/hsmtool.c +++ b/tools/hsmtool.c @@ -370,20 +370,20 @@ int main(int argc, char *argv[]) show_usage(); if (streq(method, "decrypt")) { - if (argc < 3) + if (argc < 4) show_usage(); return decrypt_hsm(argv[2], argv[3]); } if (streq(method, "encrypt")) { - if (argc < 3) + if (argc < 4) show_usage(); return encrypt_hsm(argv[2], argv[3]); } if (streq(method, "dumpcommitments")) { /* node_id channel_id depth hsm_secret ?password? */ - if (argc < 5) + if (argc < 7) show_usage(); struct node_id node_id; if (!node_id_from_hexstr(argv[2], strlen(argv[2]), &node_id)) @@ -394,7 +394,7 @@ int main(int argc, char *argv[]) if (streq(method, "guesstoremote")) { /* address node_id depth hsm_secret ?password? */ - if (argc < 5) + if (argc < 7) show_usage(); struct node_id node_id; if (!node_id_from_hexstr(argv[3], strlen(argv[3]), &node_id))