summaryrefslogtreecommitdiffstats
path: root/crypto/ec
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2015-04-29 09:58:10 +0100
committerMatt Caswell <matt@openssl.org>2015-04-30 23:21:53 +0100
commit5bea7975a6b8b83cce938618a9fcaaa248c10712 (patch)
tree52716efcca1d39bc58a88f1365d3dfa0bb990cc6 /crypto/ec
parent9c5efc9c65be2d29fd01c02bba081b72ba025453 (diff)
Add sanity check to print_bin function
Add a sanity check to the print_bin function to ensure that the |off| argument is positive. Thanks to Kevin Wojtysiak (Int3 Solutions) and Paramjot Oberoi (Int3 Solutions) for reporting this issue. Reviewed-by: Andy Polyakov <appro@openssl.org> (cherry picked from commit 3deeeeb61b0c5b9b5f0993a67b7967d2f85186da)
Diffstat (limited to 'crypto/ec')
-rw-r--r--crypto/ec/eck_prn.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/ec/eck_prn.c b/crypto/ec/eck_prn.c
index 515b262387..df9b37a750 100644
--- a/crypto/ec/eck_prn.c
+++ b/crypto/ec/eck_prn.c
@@ -346,12 +346,14 @@ static int print_bin(BIO *fp, const char *name, const unsigned char *buf,
if (buf == NULL)
return 1;
- if (off) {
+ if (off > 0) {
if (off > 128)
off = 128;
memset(str, ' ', off);
if (BIO_write(fp, str, off) <= 0)
return 0;
+ } else {
+ off = 0;
}
if (BIO_printf(fp, "%s", name) <= 0)