From e7dbd7a1e2ad3e12dafa2919bc8603d60416ea4d Mon Sep 17 00:00:00 2001 From: beck <> Date: Sat, 26 Apr 2014 18:56:38 +0000 Subject: Replace all use of ERR_add_error_data with ERR_asprintf_error_data. This avoids a lot of ugly gymnastics to do snprintfs before sending the bag of strings to ERR, and eliminates at least one place in dso_dlfctn.c where it was being called with the incorrect number of arguments and using random things off the stack as addresses of strings. ok krw@, jsing@ --- src/lib/libcrypto/pkcs7/bio_ber.c | 4 +--- src/lib/libcrypto/pkcs7/pk7_smime.c | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'src/lib/libcrypto/pkcs7') diff --git a/src/lib/libcrypto/pkcs7/bio_ber.c b/src/lib/libcrypto/pkcs7/bio_ber.c index 04dc5c9b96..d787495a21 100644 --- a/src/lib/libcrypto/pkcs7/bio_ber.c +++ b/src/lib/libcrypto/pkcs7/bio_ber.c @@ -155,7 +155,6 @@ static int ber_free(BIO *a) int bio_ber_get_header(BIO *bio, BIO_BER_CTX *ctx) { - char buf[64]; int i,j,n; int ret; unsigned char *p; @@ -215,8 +214,7 @@ int bio_ber_get_header(BIO *bio, BIO_BER_CTX *ctx) if ((ctx->tag >= 0) && (ctx->tag != tag)) { BIOerr(BIO_F_BIO_BER_GET_HEADER,BIO_R_TAG_MISMATCH); - sprintf(buf,"tag=%d, got %d",ctx->tag,tag); - ERR_add_error_data(1,buf); + ERR_asprintf_error_data("tag=%d, got %d", ctx->tag, tag); return(-1); } if (ret & 0x01) diff --git a/src/lib/libcrypto/pkcs7/pk7_smime.c b/src/lib/libcrypto/pkcs7/pk7_smime.c index a5104f8d05..6d6bd46b62 100644 --- a/src/lib/libcrypto/pkcs7/pk7_smime.c +++ b/src/lib/libcrypto/pkcs7/pk7_smime.c @@ -340,7 +340,7 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, X509_STORE_CTX_cleanup(&cert_ctx); if (i <= 0) { PKCS7err(PKCS7_F_PKCS7_VERIFY,PKCS7_R_CERTIFICATE_VERIFY_ERROR); - ERR_add_error_data(2, "Verify error:", + ERR_asprintf_error_data("Verify error:%s", X509_verify_cert_error_string(j)); sk_X509_free(signers); return 0; -- cgit v1.2.3-55-g6feb