ecore_con: fix unitialized use of buffer from strncpy.

Fix CID 1039725.
This commit is contained in:
Cedric Bail 2013-11-27 14:30:03 +09:00
parent d0837ee5f5
commit 1e70d703b3
1 changed files with 3 additions and 0 deletions

View File

@ -68,6 +68,8 @@ ecore_con_local_connect(Ecore_Con_Server *svr,
const char *homedir;
int socket_unix_len;
buf[0] = '\0';
if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_USER)
{
homedir = getenv("XDG_RUNTIME_DIR");
@ -141,6 +143,7 @@ ecore_con_local_connect(Ecore_Con_Server *svr,
}
else
{
socket_unix.sun_path[0] = '\0';
strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path));
socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix);
}