Skip to content

Commit e028aa3

Browse files
committed
Merge bitcoin#650: secp256k1/src/tests.c: Properly handle sscanf return value
a11c76c secp256k1/src/tests.c: Properly handle sscanf return value (Mustapha Abiola) Pull request description: This pull request fixes a bug which allows the `sh` variable to be used uninitialised when sscanf(3) returns EOF. Signed-off-by: Mustapha Abiola <[email protected]> ACKs for top commit: sipa: ACK a11c76c. practicalswift: utACK a11c76c real-or-random: ACK a11c76c I looked at the code Tree-SHA512: fd9660a18e39ecf9366db94ccbcec2682b020223f4f982a4356ddf56c2fbdafa5edcd830db37be12b661c1ec0b15c57b9f34ba59ef4460187c9c2478376fbc88
2 parents f1e11d3 + a11c76c commit e028aa3

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)