ecore_con: fix non initialized use of buf with strncpy.
authorCedric Bail <cedric.bail@samsung.com>
Wed, 27 Nov 2013 05:27:00 +0000 (14:27 +0900)
committerCedric Bail <cedric.bail@samsung.com>
Wed, 27 Nov 2013 05:27:00 +0000 (14:27 +0900)
This fix CID 1039723.

src/lib/ecore_con/ecore_con_socks.c

index 8ea64a9..d4adfdc 100644 (file)
@@ -578,8 +578,8 @@ ecore_con_socks_init(void)
         socks = getenv("ECORE_CON_SOCKS_V5");
         v5 = EINA_TRUE;
      }
-   if ((!socks) || (!socks[0]) || (strlen(socks) > 512)) return;
-   strncpy(buf, socks, sizeof(buf));
+   if ((!socks) || (!socks[0]) || (strlen(socks) + 1 > 512)) return;
+   memcpy(buf, socks, strlen(socks) + 1);
    h = strchr(buf, '@');
    /* username */
    if (h && (h - buf > 0)) *h++ = 0, u = buf;