From f376030ff7fe24f4ad44a56c2d8ba8796c9ab3f0 Mon Sep 17 00:00:00 2001 From: guenther <> Date: Sat, 19 Apr 2014 11:46:39 +0000 Subject: We'll interpret a (void) cast on snprintf() to mean it's been verified that truncation is either desirable, not an issue, or is detected and handled later ok deraadt@ --- src/lib/libcrypto/bio/b_dump.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/lib/libcrypto/bio/b_dump.c') diff --git a/src/lib/libcrypto/bio/b_dump.c b/src/lib/libcrypto/bio/b_dump.c index 61c9fe20a3..740686c957 100644 --- a/src/lib/libcrypto/bio/b_dump.c +++ b/src/lib/libcrypto/bio/b_dump.c @@ -108,14 +108,14 @@ BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u), for (i = 0; i < rows; i++) { buf[0] = '\0'; /* start with empty string */ strlcpy(buf, str, sizeof buf); - (void) snprintf(tmp, sizeof tmp, "%04x - ", i*dump_width); + snprintf(tmp, sizeof tmp, "%04x - ", i*dump_width); strlcat(buf, tmp, sizeof buf); for (j = 0; j < dump_width; j++) { if (((i*dump_width) + j) >= len) { strlcat(buf, " ", sizeof buf); } else { ch = ((unsigned char)*(s + i*dump_width + j)) & 0xff; - (void) snprintf(tmp, sizeof tmp, "%02x%c", ch, + snprintf(tmp, sizeof tmp, "%02x%c", ch, j == 7 ? '-' : ' '); strlcat(buf, tmp, sizeof buf); } @@ -125,7 +125,7 @@ BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u), if (((i*dump_width) + j) >= len) break; ch = ((unsigned char)*(s + i * dump_width + j)) & 0xff; - (void) snprintf(tmp, sizeof tmp, "%c", + snprintf(tmp, sizeof tmp, "%c", ((ch >= ' ') && (ch <= '~')) ? ch : '.'); strlcat(buf, tmp, sizeof buf); } @@ -137,7 +137,7 @@ BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u), } #ifdef TRUNCATE if (trc > 0) { - (void) snprintf(buf, sizeof buf, "%s%04x - \n", + snprintf(buf, sizeof buf, "%s%04x - \n", str, len + trc); ret += cb((void *)buf, strlen(buf), u); } -- cgit v1.2.3-55-g6feb