You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2010/09/04 13:24:49 UTC

svn commit: r992583 - in /httpd/httpd/trunk: CHANGES modules/generators/mod_cgid.c

Author: sf
Date: Sat Sep  4 11:24:49 2010
New Revision: 992583

URL: http://svn.apache.org/viewvc?rev=992583&view=rev
Log:
mod_cgid: Log a warning if the ScriptSock path is truncated because
it is too long.

PR 49388

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/modules/generators/mod_cgid.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=992583&r1=992582&r2=992583&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sat Sep  4 11:24:49 2010
@@ -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

Modified: httpd/httpd/trunk/modules/generators/mod_cgid.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/generators/mod_cgid.c?rev=992583&r1=992582&r2=992583&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/generators/mod_cgid.c (original)
+++ httpd/httpd/trunk/modules/generators/mod_cgid.c Sat Sep  4 11:24:49 2010
@@ -909,12 +909,20 @@ static int cgid_init(apr_pool_t *p, apr_
     }
 
     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);