tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r1302233 - /tomcat/jk/trunk/native/common/jk_shm.c
Date Sun, 18 Mar 2012 21:52:49 GMT
Author: mturk
Date: Sun Mar 18 21:52:48 2012
New Revision: 1302233

URL: http://svn.apache.org/viewvc?rev=1302233&view=rev
Log:
Use strcpy/strcat instead sprintf

Modified:
    tomcat/jk/trunk/native/common/jk_shm.c

Modified: tomcat/jk/trunk/native/common/jk_shm.c
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_shm.c?rev=1302233&r1=1302232&r2=1302233&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_shm.c (original)
+++ tomcat/jk/trunk/native/common/jk_shm.c Sun Mar 18 21:52:48 2012
@@ -175,7 +175,8 @@ int jk_shm_open(const char *fname, size_
     if (fname) {
         int i;
         SIZE_T shmsz = 0;
-        snprintf(shname, MAX_PATH - 8, "Global\\%s", fname);
+        strcpy(shname, "Global\\");
+        strncat(shname, fname, MAX_PATH - 8);
         for(i = 7; i < (int)strlen(shname); i++) {
             if (!isalnum((unsigned char)shname[i]))
                 shname[i] = '_';
@@ -183,7 +184,7 @@ int jk_shm_open(const char *fname, size_
                 shname[i] = toupper(shname[i]);
         }
         strcpy(lkname, shname);
-        strcat(lkname, "_MUTEX");
+        strncat(lkname, "_MUTEX", MAX_PATH - 1);
         jk_shm_hlock = CreateMutex(jk_get_sa_with_null_dacl(), TRUE, lkname);
         if (jk_shm_hlock == NULL) {
             if (GetLastError() == ERROR_ALREADY_EXISTS) {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message