From d528de9c6efbbc4ac901e0bc345ab13bab2536f9 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 17 Oct 2023 16:42:33 +0200 Subject: [PATCH] sm: Minor robustness fix for a regression test. * sm/t-minip12.c (run_one_test): Don't hash if we have no parameters at all. -- This fix handles the case that an empty result array is returned by minip12.c --- sm/t-minip12.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sm/t-minip12.c b/sm/t-minip12.c index 97d58d530..c9adcede6 100644 --- a/sm/t-minip12.c +++ b/sm/t-minip12.c @@ -539,7 +539,10 @@ run_one_test (const char *name, const char *desc, const char *pass, } } - resulthash = hash_buffer (tmpstring, strlen (tmpstring)); + /* Hash only if we have at least one parameter; i.e. the curve + * alone is not sufficient. */ + if (result[0]) + resulthash = hash_buffer (tmpstring, strlen (tmpstring)); xfree (tmpstring); }