From: Stefan Fritsch Date: Sat, 4 Sep 2010 11:24:49 +0000 (+0000) Subject: mod_cgid: Log a warning if the ScriptSock path is truncated because X-Git-Tag: 2.3.9~516 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7abab7934bc85be69b630e7f0cf694b301314e22;p=thirdparty%2Fapache%2Fhttpd.git mod_cgid: Log a warning if the ScriptSock path is truncated because it is too long. PR 49388 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@992583 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 199d5beb16e..9b725d34803 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ Changes with Apache 2.3.9 + *) mod_cgid: Log a warning if the ScriptSock path is truncated because + it is too long. PR 49388. [Stefan Fritsch] + *) vhosts: Do not allow _default_ in NameVirtualHost, or mixing * and non-* ports on NameVirtualHost, or multiple NameVirtualHost directives for the same address:port, or NameVirtualHost diff --git a/modules/generators/mod_cgid.c b/modules/generators/mod_cgid.c index 56bc579266c..12e1041cd33 100644 --- a/modules/generators/mod_cgid.c +++ b/modules/generators/mod_cgid.c @@ -909,12 +909,20 @@ static int cgid_init(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, } if (!first_time) { + char *tmp_sockname; total_modules = 0; for (m = ap_preloaded_modules; *m != NULL; m++) total_modules++; parent_pid = getpid(); - sockname = ap_server_root_relative(p, sockname); + tmp_sockname = ap_server_root_relative(p, sockname); + if (strlen(tmp_sockname) > sizeof(server_addr->sun_path) - 1) { + tmp_sockname[sizeof(server_addr->sun_path)] = '\0'; + ap_log_error(APLOG_MARK, APLOG_ERR, 0, main_server, + "The length of the ScriptSock path exceeds maximum, " + "truncating to %s", tmp_sockname); + } + sockname = tmp_sockname; server_addr_len = APR_OFFSETOF(struct sockaddr_un, sun_path) + strlen(sockname); server_addr = (struct sockaddr_un *)apr_palloc(p, server_addr_len + 1);