Skip to content

Commit a11c76c

Browse files
author
Mustapha Abiola
committed
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 <mustapha@trilemma.net>
1 parent fa33017 commit a11c76c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/tests.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5180,7 +5180,7 @@ int main(int argc, char **argv) {
51805180
const char* ch = argv[2];
51815181
while (pos < 16 && ch[0] != 0 && ch[1] != 0) {
51825182
unsigned short sh;
5183-
if (sscanf(ch, "%2hx", &sh)) {
5183+
if ((sscanf(ch, "%2hx", &sh)) == 1) {
51845184
seed16[pos] = sh;
51855185
} else {
51865186
break;

0 commit comments

Comments
 (0)