From: Dr. Stephen Henson Date: Sat, 15 May 2010 00:34:06 +0000 (+0000) Subject: PR: 2253 X-Git-Tag: OpenSSL-fips-2_0-rc1~1098 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=19674b5a1d10bbd4bf0537d891e8908c1d572832;p=oweals%2Fopenssl.git PR: 2253 Submitted By: Ger Hobbelt Check callback return value when outputting errors. --- diff --git a/apps/pkcs12.c b/apps/pkcs12.c index 514a02e0f1..decb23e185 100644 --- a/apps/pkcs12.c +++ b/apps/pkcs12.c @@ -813,6 +813,16 @@ int dump_certs_pkeys_bag (BIO *out, PKCS12_SAFEBAG *bag, char *pass, default: BIO_printf (bio_err, "Warning unsupported bag type: "); i2a_ASN1_OBJECT (bio_err, bag->type); +{ +unsigned char *foo = NULL; +int foolen; +FILE *op; +foolen = i2d_PKCS12_SAFEBAG(bag, &foo); +op = fopen("/tmp/unknown.der", "w"); +fwrite(foo, 1, foolen, op); +fclose(op); +} + BIO_printf (bio_err, "\n"); return 1; break; diff --git a/crypto/err/err_prn.c b/crypto/err/err_prn.c index de32f332c4..a0168ac8ed 100644 --- a/crypto/err/err_prn.c +++ b/crypto/err/err_prn.c @@ -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 */ } }