]> granicus.if.org Git - apache/commitdiff
mod_cgid: Log a warning if the ScriptSock path is truncated because
authorStefan Fritsch <sf@apache.org>
Sat, 4 Sep 2010 11:24:49 +0000 (11:24 +0000)
committerStefan Fritsch <sf@apache.org>
Sat, 4 Sep 2010 11:24:49 +0000 (11:24 +0000)
it is too long.

PR 49388

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@992583 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/generators/mod_cgid.c

diff --git a/CHANGES b/CHANGES
index 199d5beb16ecdc0e2be73d0ea19428b565ae2b13..9b725d34803adf481c54fb0c36eff58fa139c68a 100644 (file)
--- 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
index 56bc579266ce3f0bc54dc18c17267e89277fef0f..12e1041cd3350c534c7dda7d2fa453656ded7aaa 100644 (file)
@@ -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);