PR: 2253
authorDr. Stephen Henson <steve@openssl.org>
Sat, 15 May 2010 00:36:12 +0000 (00:36 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Sat, 15 May 2010 00:36:12 +0000 (00:36 +0000)
Submitted By: Ger Hobbelt <ger@hobbelt.com>

Check callback return value when outputting errors.

crypto/err/err_prn.c

index de32f332c419f68f10042aa33d2b8aaa4d5bbc7a..a0168ac8ed628fd4d511059d68b0bffaebad92ed 100644 (file)
@@ -81,7 +81,8 @@ void ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u),
                ERR_error_string_n(l, buf, sizeof buf);
                BIO_snprintf(buf2, sizeof(buf2), "%lu:%s:%s:%d:%s\n", es, buf,
                        file, line, (flags & ERR_TXT_STRING) ? data : "");
-               cb(buf2, strlen(buf2), u);
+               if (cb(buf2, strlen(buf2), u) <= 0)
+                       break; /* abort outputting the error report */
                }
        }