Skip to content

Commit

Permalink
Merge bitcoin#650: secp256k1/src/tests.c: Properly handle sscanf retu…
Browse files Browse the repository at this point in the history
…rn 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 <mustapha@trilemma.net>

ACKs for top commit:
  sipa:
    ACK a11c76c.
  practicalswift:
    utACK a11c76c
  real-or-random:
    ACK a11c76c I looked at the code

Tree-SHA512: fd9660a18e39ecf9366db94ccbcec2682b020223f4f982a4356ddf56c2fbdafa5edcd830db37be12b661c1ec0b15c57b9f34ba59ef4460187c9c2478376fbc88
  • Loading branch information
jonasnick committed Aug 18, 2019
2 parents f1e11d3 + a11c76c commit e028aa3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e028aa3

Please sign in to comment.