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

Check callback return value when outputting errors.

crypto/err/err_prn.c

index c298e161644eea0dbe798e42b4398e4f50a7a153..1e46f93ecf8136bd0f260d74aed0f1acc73cd530 100644 (file)
@@ -79,7 +79,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 */
                }
        }