diff options
author | Graham Leggett <minfrin@apache.org> | 2021-06-22 22:24:10 +0000 |
---|---|---|
committer | Graham Leggett <minfrin@apache.org> | 2021-06-22 22:24:10 +0000 |
commit | 801dbecc342f9f975419adfdf4cc703c930bb3f6 (patch) | |
tree | 94ad9792ad52743466f5e62637642029e1893839 /dbm | |
parent | 4be1214551403ac807c79c753c47df154bdb755f (diff) | |
download | apr-801dbecc342f9f975419adfdf4cc703c930bb3f6.tar.gz |
Use apr_psprintf() instead of apr_strerror() to avoid a worst case allocation.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1890980 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dbm')
-rw-r--r-- | dbm/apr_dbm.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/dbm/apr_dbm.c b/dbm/apr_dbm.c index 5d938e6c6..904543bf6 100644 --- a/dbm/apr_dbm.c +++ b/dbm/apr_dbm.c @@ -87,7 +87,7 @@ APR_DECLARE(apr_status_t) apr_dbm_get_driver(const apr_dbm_driver_t **vtable, } if (!type) { - type = DBM_NAME; + type = DBM_NAME; } *vtable = NULL; @@ -112,11 +112,10 @@ APR_DECLARE(apr_status_t) apr_dbm_get_driver(const apr_dbm_driver_t **vtable, } if (result && !*result) { - char *buffer = apr_pcalloc(pool, ERROR_SIZE); apu_err_t *err = apr_pcalloc(pool, sizeof(apu_err_t)); - if (err && buffer) { - apr_strerror(APR_ENOTIMPL, buffer, ERROR_SIZE - 1); - err->msg = buffer; + if (err) { + apr_status_t rv = APR_ENOTIMPL; + err->msg = apr_psprintf(pool, "%pm", &rv); err->reason = apr_pstrdup(pool, type); *result = err; } @@ -138,7 +137,7 @@ APR_DECLARE(apr_status_t) apr_dbm_get_driver(const apr_dbm_driver_t **vtable, } if (!type) { - type = DBM_NAME; + type = DBM_NAME; } if (!strcasecmp(type, "default")) type = DBM_NAME; |