eina: use less stack on Windows for eina_environment_home_get, and no snprintf()
authorVincent Torri <vincent.torri@gmail.com>
Fri, 15 May 2015 07:03:48 +0000 (09:03 +0200)
committerCedric BAIL <cedric@osg.samsung.com>
Mon, 18 May 2015 08:36:58 +0000 (10:36 +0200)
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
src/lib/eina/eina_util.c

index 392eee3..4f04084 100644 (file)
@@ -41,7 +41,7 @@
  *============================================================================*/
 
 #ifdef _WIN32
-static char home_storage[PATH_MAX];
+static char home_storage[8];
 #endif
 
 EAPI const char *
@@ -55,8 +55,9 @@ eina_environment_home_get(void)
    if (!home &&
        (getenv("HOMEDRIVE") && getenv("HOMEPATH")))
      {
-        snprintf(home_storage, sizeof(home_storage), "%s%s",
-                 getenv("HOMEDRIVE"), getenv("HOMEPATH"));
+        memcpy(home_storage, getenv("HOMEDRIVE"), strlen(getenv("HOMEDRIVE")));
+        memcpy(home_storage + strlen(getenv("HOMEDRIVE")),
+               getenv("HOMEPATH"), strlen(getenv("HOMEPATH")) + 1);
         home = home_storage;
      }
    if (!home) home = "C:\\";