You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2010/02/09 18:20:26 UTC

svn commit: r908122 - in /httpd/mod_fcgid/trunk/modules/fcgid: fcgid_proc_unix.c fcgid_proc_win.c

Author: trawick
Date: Tue Feb  9 17:20:25 2010
New Revision: 908122

URL: http://svn.apache.org/viewvc?rev=908122&view=rev
Log:
use apr_cpystrn instead of bizarre strncpy

fix a couple of existing calls to apr_cpystrn

Modified:
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_unix.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_win.c

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_unix.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_unix.c?rev=908122&r1=908121&r2=908122&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_unix.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_unix.c Tue Feb  9 17:20:25 2010
@@ -211,11 +211,11 @@
     apr_snprintf(unix_addr.sun_path, sizeof(unix_addr.sun_path) - 1,
                  "%s/%" APR_PID_T_FMT ".%d", sconf->sockname_prefix,
                  getpid(), g_process_counter++);
-    strncpy(procnode->socket_path, unix_addr.sun_path,
-            sizeof(procnode->socket_path) - 1);
-    strncpy(procnode->executable_path,
-            (lpszwapper != NULL && lpszwapper[0] != '\0') ? wargv[0] : procinfo->cgipath,
-            sizeof(procnode->executable_path) - 1);
+    apr_cpystrn(procnode->socket_path, unix_addr.sun_path,
+                sizeof(procnode->socket_path));
+    apr_cpystrn(procnode->executable_path,
+                (lpszwapper != NULL && lpszwapper[0] != '\0') ? wargv[0] : procinfo->cgipath,
+                sizeof(procnode->executable_path));
 
     /* Unlink the file just in case */
     unlink(unix_addr.sun_path);

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_win.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_win.c?rev=908122&r1=908121&r2=908122&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_win.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_win.c Tue Feb  9 17:20:25 2010
@@ -131,10 +131,10 @@
                      "mod_fcgid: can't create namedpipe for subprocess");
         return APR_ENOSOCKET;
     }
-    apr_cpystrn(procnode->socket_path, sock_path, sizeof(procnode->socket_path) - 1);
+    apr_cpystrn(procnode->socket_path, sock_path, sizeof(procnode->socket_path));
     apr_cpystrn(procnode->executable_path,
                 (wrapper_cmdline != NULL && wrapper_cmdline[0] != '\0') ? wargv[0] : procinfo->cgipath,
-                sizeof(procnode->executable_path) - 1);
+                sizeof(procnode->executable_path));
 
     /* Build environment variables */
     proc_environ = ap_create_environment(procnode->proc_pool,