From: Hannes Reinecke Date: Fri, 17 Nov 2023 07:11:24 +0000 (+0100) Subject: nvme: fixup length calculation for 'nvme gen-tls-key --secret' X-Git-Tag: v2.7~44 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3b9d42fcb98bae5dbd7b8444dee3696a695408c9;p=users%2Fsagi%2Fnvme-cli.git nvme: fixup length calculation for 'nvme gen-tls-key --secret' The raw secret is passed in hex, so the length of the input is twice the size of the key. Signed-off-by: Hannes Reinecke --- diff --git a/nvme.c b/nvme.c index fb0afca1..1fb20036 100644 --- a/nvme.c +++ b/nvme.c @@ -8715,7 +8715,7 @@ static int gen_tls_key(int argc, char **argv, struct command *command, struct pl nvme_show_error("Invalid secret '%s'", cfg.secret); return -EINVAL; } - if (i >= key_len) { + if (i >= key_len * 2) { fprintf(stderr, "Skipping excess secret bytes\n"); break; }