Remove code that prints "<SPACES/NULS>" in hexdumps
when the data block ends with SPACEs or NULs.
The problem is, you can't see if the data ends
with SPACE or NUL or a combination of both.
This can happen for instance with
openssl rsautl -decrypt -hexdump
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5332)
Bernd Edlinger
6 years ago
13 | 13 | #include <stdio.h> |
14 | 14 | #include "bio_lcl.h" |
15 | 15 | |
16 | #define TRUNCATE | |
17 | 16 | #define DUMP_WIDTH 16 |
18 | 17 | #define DUMP_WIDTH_LESS_INDENT(i) (DUMP_WIDTH-((i-(i>6?6:i)+3)/4)) |
19 | 18 | |
28 | 27 | { |
29 | 28 | int ret = 0; |
30 | 29 | char buf[288 + 1], tmp[20], str[128 + 1]; |
31 | int i, j, rows, trc; | |
30 | int i, j, rows; | |
32 | 31 | unsigned char ch; |
33 | 32 | int dump_width; |
34 | ||
35 | trc = 0; | |
36 | ||
37 | #ifdef TRUNCATE | |
38 | for (; (len > 0) && ((s[len - 1] == ' ') || (s[len - 1] == '\0')); len--) | |
39 | trc++; | |
40 | #endif | |
41 | 33 | |
42 | 34 | if (indent < 0) |
43 | 35 | indent = 0; |
89 | 81 | */ |
90 | 82 | ret += cb((void *)buf, strlen(buf), u); |
91 | 83 | } |
92 | #ifdef TRUNCATE | |
93 | if (trc > 0) { | |
94 | BIO_snprintf(buf, sizeof(buf), "%s%04x - <SPACES/NULS>\n", str, | |
95 | len + trc); | |
96 | ret += cb((void *)buf, strlen(buf), u); | |
97 | } | |
98 | #endif | |
99 | return (ret); | |
84 | return ret; | |
100 | 85 | } |
101 | 86 | |
102 | 87 | #ifndef OPENSSL_NO_STDIO |