summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbcook <>2015-07-18 17:19:56 +0000
committerbcook <>2015-07-18 17:19:56 +0000
commit51dcc2533220455b6431924dd171f437019c5860 (patch)
tree6d9e5d9752bfe8122f6cdddebdb596b76cf107de /src
parent5f757bbcee25110b6c1d961e2c1f48a1c8a3c942 (diff)
downloadopenbsd-51dcc2533220455b6431924dd171f437019c5860.tar.gz
openbsd-51dcc2533220455b6431924dd171f437019c5860.tar.bz2
openbsd-51dcc2533220455b6431924dd171f437019c5860.zip
check sscanf conversion, fixes Coverity 21666
ok doug@, miod@, guenther@
Diffstat (limited to 'src')
-rw-r--r--src/regress/lib/libcrypto/evp/evptest.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/regress/lib/libcrypto/evp/evptest.c b/src/regress/lib/libcrypto/evp/evptest.c
index a71c1fb55a..bd5da475f1 100644
--- a/src/regress/lib/libcrypto/evp/evptest.c
+++ b/src/regress/lib/libcrypto/evp/evptest.c
@@ -81,10 +81,14 @@ convert(unsigned char *s)
81 unsigned int n; 81 unsigned int n;
82 82
83 if (!s[1]) { 83 if (!s[1]) {
84 fprintf(stderr, "Odd number of hex digits!"); 84 fprintf(stderr, "Odd number of hex digits!\n");
85 exit(4); 85 exit(4);
86 } 86 }
87 sscanf((char *)s, "%2x",&n); 87 if (sscanf((char *)s, "%2x", &n) != 1) {
88 fprintf(stderr, "Invalid hex value at %s\n", s);
89 exit(4);
90 }
91
88 *d = (unsigned char)n; 92 *d = (unsigned char)n;
89 } 93 }
90 return s - d; 94 return s - d;