From: Dr. David von Oheimb Date: Sat, 12 Jun 2021 11:41:19 +0000 (+0200) Subject: BIO_dum_indent_cb(): Fix handling of cb return value X-Git-Tag: openssl-3.0.0-beta1~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b66592490e7b43b94298f53d4e58a611644fe4e;p=thirdparty%2Fopenssl.git BIO_dum_indent_cb(): Fix handling of cb return value Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/15722) --- diff --git a/crypto/bio/b_dump.c b/crypto/bio/b_dump.c index b99ebc0486e..104813959c1 100644 --- a/crypto/bio/b_dump.c +++ b/crypto/bio/b_dump.c @@ -29,7 +29,7 @@ int BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u), void *u, const void *v, int len, int indent) { const unsigned char *s = v; - int ret = 0; + int res, ret = 0; char buf[288 + 1]; int i, j, rows, n; unsigned char ch; @@ -86,7 +86,10 @@ int BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u), * if this is the last call then update the ddt_dump thing so that we * will move the selection point in the debug window */ - ret += cb((void *)buf, n, u); + res = cb((void *)buf, n, u); + if (res < 0) + return res; + ret += res; } return ret; }