diff options
Diffstat (limited to 'src/lib/libcrypto/bio/b_dump.c')
-rw-r--r-- | src/lib/libcrypto/bio/b_dump.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/lib/libcrypto/bio/b_dump.c b/src/lib/libcrypto/bio/b_dump.c index 0214addc8b..7e1c2d7947 100644 --- a/src/lib/libcrypto/bio/b_dump.c +++ b/src/lib/libcrypto/bio/b_dump.c | |||
@@ -1,10 +1,10 @@ | |||
1 | /* $OpenBSD: b_dump.c,v 1.21 2015/04/23 06:11:19 deraadt Exp $ */ | 1 | /* $OpenBSD: b_dump.c,v 1.22 2021/07/11 20:18:07 beck Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This package is an SSL implementation written | 5 | * This package is an SSL implementation written |
6 | * by Eric Young (eay@cryptsoft.com). | 6 | * by Eric Young (eay@cryptsoft.com). |
7 | * The implementation was written so as to conform with Netscapes SSL. | 7 | * The implementation was written so as to conform with Netscapes SSL. |
8 | * | 8 | * |
9 | * This library is free for commercial and non-commercial use as long as | 9 | * This library is free for commercial and non-commercial use as long as |
10 | * the following conditions are aheared to. The following conditions | 10 | * the following conditions are aheared to. The following conditions |
@@ -82,7 +82,7 @@ BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u), | |||
82 | { | 82 | { |
83 | int ret = 0; | 83 | int ret = 0; |
84 | char buf[288 + 1], tmp[20], str[128 + 1]; | 84 | char buf[288 + 1], tmp[20], str[128 + 1]; |
85 | int i, j, rows, trc; | 85 | int i, j, rows, trc, written; |
86 | unsigned char ch; | 86 | unsigned char ch; |
87 | int dump_width; | 87 | int dump_width; |
88 | 88 | ||
@@ -133,13 +133,18 @@ BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u), | |||
133 | /* if this is the last call then update the ddt_dump thing so | 133 | /* if this is the last call then update the ddt_dump thing so |
134 | * that we will move the selection point in the debug window | 134 | * that we will move the selection point in the debug window |
135 | */ | 135 | */ |
136 | ret += cb((void *)buf, strlen(buf), u); | 136 | if ((written = cb((void *)buf, strlen(buf), u)) < 0) |
137 | return -1; | ||
138 | ret += written; | ||
139 | |||
137 | } | 140 | } |
138 | #ifdef TRUNCATE | 141 | #ifdef TRUNCATE |
139 | if (trc > 0) { | 142 | if (trc > 0) { |
140 | snprintf(buf, sizeof buf, "%s%04x - <SPACES/NULS>\n", | 143 | snprintf(buf, sizeof buf, "%s%04x - <SPACES/NULS>\n", |
141 | str, len + trc); | 144 | str, len + trc); |
142 | ret += cb((void *)buf, strlen(buf), u); | 145 | if ((written = cb((void *)buf, strlen(buf), u)) < 0) |
146 | return -1; | ||
147 | ret += written; | ||
143 | } | 148 | } |
144 | #endif | 149 | #endif |
145 | return (ret); | 150 | return (ret); |