OSDN Git Service

Ver.1.5.34 Fixed CLang warning and others
[opengate/opengate.git] / opengate / opengatesrv / utilities.c
index 81d8d11..100a325 100644 (file)
@@ -210,14 +210,14 @@ FILE *Popenl(int rootPriv, const char *type, const char *path, ...)
   FILE *file;
 
   /* insert command path */
-  strncpy(commandLine, path, BUFFMAXLN);
+  strlcpy(commandLine, path, BUFFMAXLN);
 
   /* insert command arguments */
   va_start(ap, path);
   
   while((pStr=va_arg(ap, char *))!=(char *)0){
     strcat(commandLine, " ");
-    strncat(commandLine, pStr, BUFFMAXLN);
+    strlcat(commandLine, pStr, BUFFMAXLN);
   }
 
   va_end(ap);
@@ -257,14 +257,14 @@ int Systeml(int rootPriv, const char *path, ...)
   int ret;
 
   /* insert command path */
-  strncpy(commandLine, path, BUFFMAXLN);
+  strlcpy(commandLine, path, BUFFMAXLN);
 
   /* insert command arguments */
   va_start(ap, path);
   
   while((pStr=va_arg(ap, char *))!=(char *)0){
     strcat(commandLine, " ");
-    strncat(commandLine, pStr, BUFFMAXLN);
+    strlcat(commandLine, pStr, BUFFMAXLN);
   }
 
   va_end(ap);
@@ -362,7 +362,7 @@ void createCookie(char *cookie)
   char str[BUFFMAXLN];
 
   /* make Http-cookie from pid&time */
-  snprintf(str, BUFFMAXLN, "%d%d", getpid(),time(NULL));
+  snprintf(str, BUFFMAXLN, "%d%ld", getpid(),time(NULL));
   md5hex(cookie, SIDMAXLN, str);
 }
 
@@ -385,7 +385,7 @@ char* getenvEx(char* env, int pre, int post){
   int found=FALSE;
 
   /* copy string not to destroy it */
-  strncpy(work, env, BUFFMAXLN);
+  strlcpy(work, env, BUFFMAXLN);
 
   /* repeat for variables */
   thisVar=nextVar=work;