diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2011-04-06 18:06:54 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2011-04-06 18:06:54 +0000 |
commit | f2c358c6ceeaa186eb5b05adaca08d3398065144 (patch) | |
tree | de1eb8f8f9d74ff77a10e50c0aa852a658b70fff /crypto | |
parent | 2ab42de1ec2303f1ab2e155c260158580c3c57e5 (diff) |
check buffer is larger enough before overwriting
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/ecdsa/ecdsatest.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/crypto/ecdsa/ecdsatest.c b/crypto/ecdsa/ecdsatest.c index aa4e1481a8..26a4a9ee7c 100644 --- a/crypto/ecdsa/ecdsatest.c +++ b/crypto/ecdsa/ecdsatest.c @@ -168,10 +168,9 @@ int fbytes(unsigned char *buf, int num) return 0; } fbytes_counter ++; - ret = BN_bn2bin(tmp, buf); - if (ret == 0 || ret != num) + if (num != BN_num_bytes(tmp) || !BN_bn2bin(tmp, buf)) ret = 0; - else + else ret = 1; if (tmp) BN_free(tmp); |