The branch master has been updated
via 453fc7a0185dcd046a8ab2b029e0807a073f93c2 (commit)
from 6378809b226a765a0c6d7e3cb375bac12ebb54cd (commit)
- Log -----------------------------------------------------------------
commit 453fc7a0185dcd046a8ab2b029e0807a073f93c2
Author: Richard Levitte <[email protected]>
Date: Mon May 30 05:41:57 2016 +0200
Make sure max in fmtstr() doesn't overflow into negativity
Reviewed-by: Matt Caswell <[email protected]>
-----------------------------------------------------------------------
Summary of changes:
crypto/bio/b_print.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/crypto/bio/b_print.c b/crypto/bio/b_print.c
index 545c469..1b70bac 100644
--- a/crypto/bio/b_print.c
+++ b/crypto/bio/b_print.c
@@ -390,8 +390,16 @@ fmtstr(char **sbuffer,
padlen = min - strln;
if (min < 0 || padlen < 0)
padlen = 0;
- if (max >= 0)
- max += padlen; /* The maximum output including padding */
+ if (max >= 0) {
+ /*
+ * Calculate the maximum output including padding.
+ * Make sure max doesn't overflow into negativity
+ */
+ if (max < INT_MAX - padlen)
+ max += padlen;
+ else
+ max = INT_MAX;
+ }
if (flags & DP_F_MINUS)
padlen = -padlen;
_____
openssl-commits mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-commits