提交 19674b5a 编写于 作者: D Dr. Stephen Henson

PR: 2253

Submitted By: Ger Hobbelt <ger@hobbelt.com>

Check callback return value when outputting errors.
上级 e855d538
......@@ -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;
......
......@@ -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 */
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册