ecore_con: fix non initialized use of buf with strncpy.

This fix CID 1039723.
This commit is contained in:
Cedric Bail 2013-11-27 14:27:00 +09:00
parent 403098fdb2
commit d0837ee5f5
1 changed files with 2 additions and 2 deletions

View File

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