From: Tomas Mraz Date: Fri, 25 Apr 2025 08:04:37 +0000 (+0200) Subject: BIO_dump_indent_cb(): Check for negative return from BIO_snprintf() X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=56c739816f3dacbb024ceae29c546abe677ee02c;p=thirdparty%2Fopenssl.git BIO_dump_indent_cb(): Check for negative return from BIO_snprintf() In practice this cannot happen but Coverity complains. Fixes Coverity 1646683 Reviewed-by: Matt Caswell Reviewed-by: Saša Nedvědický (Merged from https://github.com/openssl/openssl/pull/27493) --- diff --git a/crypto/bio/bio_dump.c b/crypto/bio/bio_dump.c index 40c18410e4c..a566a9efe48 100644 --- a/crypto/bio/bio_dump.c +++ b/crypto/bio/bio_dump.c @@ -47,6 +47,8 @@ int BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u), for (i = 0; i < rows; i++) { n = BIO_snprintf(buf, sizeof(buf), "%*s%04x - ", indent, "", i * dump_width); + if (n < 0) + return -1; for (j = 0; j < dump_width; j++) { if (SPACE(buf, n, 3)) { if (((i * dump_width) + j) >= len) {