[tor-commits] [tor/master] Check tor_sscanf return value in test_crypto.c

nickm at torproject.org nickm at torproject.org
Mon Jun 6 14:02:21 UTC 2016


commit 83513a93a15c2e006fcf56d7d97ace5be340b6bc
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon Jun 6 10:01:50 2016 -0400

    Check tor_sscanf return value in test_crypto.c
    
    Coverity noticed that we check tor_sscanf's return value everywhere
    else.
---
 src/test/test_crypto.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c
index c128333..d3e12b6 100644
--- a/src/test/test_crypto.c
+++ b/src/test/test_crypto.c
@@ -162,7 +162,8 @@ test_crypto_openssl_version(void *arg)
   tt_assert(!strcmpstart(version, h_version)); /* "-fips" suffix, etc */
   tt_assert(!strstr(version, "OpenSSL"));
   int a=-1,b=-1,c=-1;
-  tor_sscanf(version, "%d.%d.%d", &a,&b,&c);
+  int r = tor_sscanf(version, "%d.%d.%d", &a,&b,&c);
+  tt_int_op(r, OP_EQ, 3);
   tt_int_op(a, OP_GE, 0);
   tt_int_op(b, OP_GE, 0);
   tt_int_op(c, OP_GE, 0);



More information about the tor-commits mailing list