From 47bb6e76785f0b1c4d19d8d0a02f3eb3813f96e2 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/engine/eng_cnf.c | 6 +++--- src/lib/libcrypto/engine/eng_fat.c | 2 +- src/lib/libcrypto/engine/eng_list.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/lib/libcrypto/engine') diff --git a/src/lib/libcrypto/engine/eng_cnf.c b/src/lib/libcrypto/engine/eng_cnf.c index 95c4070015..afb704e93b 100644 --- a/src/lib/libcrypto/engine/eng_cnf.c +++ b/src/lib/libcrypto/engine/eng_cnf.c @@ -203,9 +203,9 @@ static int int_engine_configure(char *name, char *value, const CONF *cnf) { ENGINEerr(ENGINE_F_INT_ENGINE_CONFIGURE, ENGINE_R_ENGINE_CONFIGURATION_ERROR); if (ecmd) - ERR_add_error_data(6, "section=", ecmd->section, - ", name=", ecmd->name, - ", value=", ecmd->value); + ERR_asprintf_error_data + ("section=%s, name=%s, value=%s", + ecmd->section, ecmd->name, ecmd->value); } if (e) ENGINE_free(e); diff --git a/src/lib/libcrypto/engine/eng_fat.c b/src/lib/libcrypto/engine/eng_fat.c index 789b8d57e5..e01067566e 100644 --- a/src/lib/libcrypto/engine/eng_fat.c +++ b/src/lib/libcrypto/engine/eng_fat.c @@ -141,7 +141,7 @@ int ENGINE_set_default_string(ENGINE *e, const char *def_list) { ENGINEerr(ENGINE_F_ENGINE_SET_DEFAULT_STRING, ENGINE_R_INVALID_STRING); - ERR_add_error_data(2, "str=",def_list); + ERR_asprintf_error_data("str=%s",def_list); return 0; } return ENGINE_set_default(e, flags); diff --git a/src/lib/libcrypto/engine/eng_list.c b/src/lib/libcrypto/engine/eng_list.c index 95c858960b..5528b5478f 100644 --- a/src/lib/libcrypto/engine/eng_list.c +++ b/src/lib/libcrypto/engine/eng_list.c @@ -389,7 +389,7 @@ ENGINE *ENGINE_by_id(const char *id) { ENGINEerr(ENGINE_F_ENGINE_BY_ID, ENGINE_R_NO_SUCH_ENGINE); - ERR_add_error_data(2, "id=", id); + ERR_asprintf_error_data("id=%s", id); } return iterator; #else @@ -416,7 +416,7 @@ ENGINE *ENGINE_by_id(const char *id) notfound: ENGINE_free(iterator); ENGINEerr(ENGINE_F_ENGINE_BY_ID,ENGINE_R_NO_SUCH_ENGINE); - ERR_add_error_data(2, "id=", id); + ERR_asprintf_error_data("id=%s", id); return NULL; /* EEK! Experimental code ends */ #endif -- cgit v1.2.3-55-g6feb