summaryrefslogtreecommitdiff
path: root/dso
diff options
context:
space:
mode:
authorBrian Havard <bjh@apache.org>2001-10-21 03:48:15 +0000
committerBrian Havard <bjh@apache.org>2001-10-21 03:48:15 +0000
commit9dd5029a5f0ccbd36f75451e36908126262d10a0 (patch)
tree49ba9538063d11929d0c5942772a2c4af35f1232 /dso
parent8539c791866bc4b5e48d6e8f6178b3a6b1d77ef5 (diff)
downloadapr-9dd5029a5f0ccbd36f75451e36908126262d10a0.tar.gz
OS/2: Return a proper error code from apr_dso_sym() & prevent NULL dereference
in apr_dso_error() if called after a failure in apr_dso_sym(). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@62451 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dso')
-rw-r--r--dso/os2/dso.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/dso/os2/dso.c b/dso/os2/dso.c
index 2b0a1cde9..b6c53adf5 100644
--- a/dso/os2/dso.c
+++ b/dso/os2/dso.c
@@ -118,8 +118,10 @@ APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym,
if (symname == NULL || ressym == NULL)
return APR_EINIT;
- if ((rc = DosQueryProcAddr(handle->handle, 0, symname, &func)) != 0)
- return APR_EINIT;
+ if ((rc = DosQueryProcAddr(handle->handle, 0, symname, &func)) != 0) {
+ handle->load_error = APR_FROM_OS_ERROR(rc);
+ return handle->load_error;
+ }
*ressym = func;
return APR_SUCCESS;
@@ -131,9 +133,13 @@ APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buffer, apr
{
char message[200];
apr_strerror(dso->load_error, message, sizeof(message));
- strcat(message, " (");
- strcat(message, dso->failed_module);
- strcat(message, ")");
+
+ if (dso->failed_module != NULL) {
+ strcat(message, " (");
+ strcat(message, dso->failed_module);
+ strcat(message, ")");
+ }
+
apr_cpystrn(buffer, message, buflen);
return buffer;
}