evas: Fix buffer overflows on environment variables
authorHenrique Dante de Almeida <hdante@profusion.mobi>
Mon, 28 Jan 2013 19:12:50 +0000 (17:12 -0200)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Tue, 26 Feb 2013 13:17:28 +0000 (10:17 -0300)
src/bin/evas/evas_cserve2_client.c
src/bin/evas/evas_cserve2_debug.c
src/bin/evas/evas_cserve2_main_loop_linux.c
src/bin/evas/evas_cserve2_usage.c
src/lib/evas/cserve2/evas_cs2_client.c

index 9d63b87..91999f0 100644 (file)
@@ -369,7 +369,7 @@ int main(void)
                  (int)getuid());
         env = buf;
      }
-   strncpy(remote.sun_path, env, UNIX_PATH_MAX - 1);
+   eina_strlcpy(remote.sun_path, env, UNIX_PATH_MAX);
    len = strlen(remote.sun_path) + sizeof(remote.sun_family);
    if (connect(s, (struct sockaddr *)&remote, len) == -1)
      {
index 1dd67c7..ce8e3e4 100644 (file)
@@ -49,7 +49,7 @@ _socket_path_set(char *path)
    env = getenv("EVAS_CSERVE2_SOCKET");
    if (env && env[0])
      {
-        strncpy(path, env, UNIX_PATH_MAX - 1);
+        eina_strlcpy(path, env, UNIX_PATH_MAX);
         return;
      }
 
index 0fd40ea..ca156f2 100644 (file)
@@ -210,7 +210,7 @@ _socket_path_set(char *path)
    env = getenv("EVAS_CSERVE2_SOCKET");
    if (env && env[0])
      {
-        strncpy(path, env, UNIX_PATH_MAX - 1);
+        eina_strlcpy(path, env, UNIX_PATH_MAX);
         return;
      }
 
index 2aa3ff3..294f5c3 100644 (file)
@@ -49,7 +49,7 @@ _socket_path_set(char *path)
    env = getenv("EVAS_CSERVE2_SOCKET");
    if (env && env[0])
      {
-        strncpy(path, env, UNIX_PATH_MAX - 1);
+        eina_strlcpy(path, env, UNIX_PATH_MAX);
         return;
      }
 
index dd91db7..43bdd23 100644 (file)
@@ -56,7 +56,7 @@ _socket_path_set(char *path)
    env = getenv("EVAS_CSERVE2_SOCKET");
    if (env && env[0])
      {
-        strncpy(path, env, UNIX_PATH_MAX - 1);
+        eina_strlcpy(path, env, UNIX_PATH_MAX);
         return;
      }