From a11c76c59a431e3492994f71a968a838e398fb58 Mon Sep 17 00:00:00 2001 From: Mustapha Abiola Date: Sun, 14 Jul 2019 17:02:58 +0200 Subject: [PATCH] secp256k1/src/tests.c: Properly handle sscanf return value This pull request fixes a bug which allows the `sh` variable to be used uninitialized when sscanf returns EOF. Signed-off-by: Mustapha Abiola --- src/tests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests.c b/src/tests.c index 132df9ba9c..cab3bcfb70 100644 --- a/src/tests.c +++ b/src/tests.c @@ -5180,7 +5180,7 @@ int main(int argc, char **argv) { const char* ch = argv[2]; while (pos < 16 && ch[0] != 0 && ch[1] != 0) { unsigned short sh; - if (sscanf(ch, "%2hx", &sh)) { + if ((sscanf(ch, "%2hx", &sh)) == 1) { seed16[pos] = sh; } else { break;