]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
BIO_dum_indent_cb(): Fix handling of cb return value
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Sat, 12 Jun 2021 11:41:19 +0000 (13:41 +0200)
committerDr. David von Oheimb <dev@ddvo.net>
Tue, 15 Jun 2021 12:23:29 +0000 (14:23 +0200)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15722)

crypto/bio/b_dump.c

index b99ebc0486ebdf978f162e7d53961b490b3547e1..104813959c1c8d64f80eb403e79e07b1f5f137c1 100644 (file)
@@ -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;
 }