From: tb Date: Sat, 22 Jul 2023 17:14:08 +0000 (+0000) Subject: Simplify indent handling in bn_print() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=5c1ba175a9566763aab6a734f35ebfe2e385fa60;p=openbsd Simplify indent handling in bn_print() variant of a suggestion by jsing --- diff --git a/lib/libcrypto/bn/bn_print.c b/lib/libcrypto/bn/bn_print.c index afcb82396a5..e7678f7a990 100644 --- a/lib/libcrypto/bn/bn_print.c +++ b/lib/libcrypto/bn/bn_print.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_print.c,v 1.45 2023/07/10 02:29:28 tb Exp $ */ +/* $OpenBSD: bn_print.c,v 1.46 2023/07/22 17:14:08 tb Exp $ */ /* * Copyright (c) 2023 Theo Buehler @@ -17,7 +17,6 @@ */ #include -#include #include #include #include @@ -73,11 +72,9 @@ bn_print_bignum(BIO *bio, const BIGNUM *bn, int indent) goto err; /* Secondary indent is 4 spaces, capped at 128. */ - if (indent > INT_MAX - 4) - goto err; + if (indent > 124) + indent = 124; indent += 4; - if (indent > 128) - indent = 128; if (indent < 0) indent = 0;