summaryrefslogtreecommitdiff
path: root/server/config.c
diff options
context:
space:
mode:
authorWilliam A. Rowe Jr <wrowe@apache.org>2002-03-16 18:26:58 +0000
committerWilliam A. Rowe Jr <wrowe@apache.org>2002-03-16 18:26:58 +0000
commit65a37752ec30e81ebf8b41d679fd031a23b45f84 (patch)
treec386dd974ba944fc1e55885cbcae317077bf390c /server/config.c
parent8bc668d002961ea8b9ade323f01834d9beba9da8 (diff)
downloadhttpd-65a37752ec30e81ebf8b41d679fd031a23b45f84.tar.gz
Eliminate potential ap_server_root_relative segfaults, with the input
of Jeff Trawick's style changes to the first patches. Doesn't include the fixes to ssl [more complex], and we won't trap errors that involve ap_serverroot, since we presume that was normalized on the way in. Therefore, testing ap_server_root_relative(DEFAULT_FOO) cases should never become necessary. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93965 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/config.c')
-rw-r--r--server/config.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/server/config.c b/server/config.c
index e2f3578529..037f88b3a9 100644
--- a/server/config.c
+++ b/server/config.c
@@ -1209,11 +1209,17 @@ AP_DECLARE_NONSTD(const char *) ap_set_file_slot(cmd_parms *cmd, void *struct_pt
* This allows most args to be independent of server_root,
* so the server can be moved or mirrored with less pain.
*/
- const char *p;
+ const char *path;
int offset = (int)(long)cmd->info;
- p = ap_server_root_relative(cmd->pool, arg);
- *(const char **) ((char*)struct_ptr + offset) = p;
+ path = ap_server_root_relative(cmd->pool, arg);
+
+ if (!path) {
+ return apr_pstrcat(cmd->pool, "Invalid file path ",
+ arg, NULL);
+ }
+
+ *(const char **) ((char*)struct_ptr + offset) = path;
return NULL;
}
@@ -1757,6 +1763,13 @@ AP_DECLARE(server_rec*) ap_read_config(process_rec *process, apr_pool_t *ptemp,
*/
confname = ap_server_root_relative(p, filename);
+ if (!confname) {
+ ap_log_error(APLOG_MARK, APLOG_STARTUP|APLOG_CRIT,
+ APR_EBADPATH, NULL, "Invalid config file path %s",
+ filename);
+ exit(1);
+ }
+
ap_process_resource_config(s, confname, conftree, p, ptemp);
process_command_config(s, ap_server_post_read_config, conftree,