diff options
author | tb <> | 2023-07-22 17:14:08 +0000 |
---|---|---|
committer | tb <> | 2023-07-22 17:14:08 +0000 |
commit | e9a7e4bafe1b6b3afcaa49237b2409d6880f0d17 (patch) | |
tree | 8f8e5203afda3c9d2bbccfb722f453f3b6309365 | |
parent | 08a6fe4a707fcb3e3dc31c061ca93f76a54b6067 (diff) | |
download | openbsd-e9a7e4bafe1b6b3afcaa49237b2409d6880f0d17.tar.gz openbsd-e9a7e4bafe1b6b3afcaa49237b2409d6880f0d17.tar.bz2 openbsd-e9a7e4bafe1b6b3afcaa49237b2409d6880f0d17.zip |
Simplify indent handling in bn_print()
variant of a suggestion by jsing
-rw-r--r-- | src/lib/libcrypto/bn/bn_print.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/lib/libcrypto/bn/bn_print.c b/src/lib/libcrypto/bn/bn_print.c index afcb82396a..e7678f7a99 100644 --- a/src/lib/libcrypto/bn/bn_print.c +++ b/src/lib/libcrypto/bn/bn_print.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bn_print.c,v 1.45 2023/07/10 02:29:28 tb Exp $ */ | 1 | /* $OpenBSD: bn_print.c,v 1.46 2023/07/22 17:14:08 tb Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2023 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2023 Theo Buehler <tb@openbsd.org> |
@@ -17,7 +17,6 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <ctype.h> | 19 | #include <ctype.h> |
20 | #include <limits.h> | ||
21 | #include <stdarg.h> | 20 | #include <stdarg.h> |
22 | #include <stdio.h> | 21 | #include <stdio.h> |
23 | #include <stdint.h> | 22 | #include <stdint.h> |
@@ -73,11 +72,9 @@ bn_print_bignum(BIO *bio, const BIGNUM *bn, int indent) | |||
73 | goto err; | 72 | goto err; |
74 | 73 | ||
75 | /* Secondary indent is 4 spaces, capped at 128. */ | 74 | /* Secondary indent is 4 spaces, capped at 128. */ |
76 | if (indent > INT_MAX - 4) | 75 | if (indent > 124) |
77 | goto err; | 76 | indent = 124; |
78 | indent += 4; | 77 | indent += 4; |
79 | if (indent > 128) | ||
80 | indent = 128; | ||
81 | if (indent < 0) | 78 | if (indent < 0) |
82 | indent = 0; | 79 | indent = 0; |
83 | 80 | ||