mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 05:27:20 +00:00
[client] X11/i3: write directly into sun_path to avoid strncpy
This commit is contained in:
parent
aa42751743
commit
cf51503a54
@ -71,9 +71,9 @@ static bool wm_i3_init(void)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
struct sockaddr_un addr = { .sun_family = AF_UNIX };
|
struct sockaddr_un addr = { .sun_family = AF_UNIX };
|
||||||
char path[sizeof(addr.sun_path)];
|
char * path = (char *)&addr.sun_path;
|
||||||
int pathLen;
|
int pathLen;
|
||||||
if ((pathLen = fread(path, 1, sizeof(path), fd)) <= 0)
|
if ((pathLen = fread(path, 1, sizeof(addr.sun_path), fd)) <= 0)
|
||||||
{
|
{
|
||||||
pclose(fd);
|
pclose(fd);
|
||||||
return false;
|
return false;
|
||||||
@ -91,7 +91,6 @@ static bool wm_i3_init(void)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(addr.sun_path, path, sizeof(addr.sun_path));
|
|
||||||
if (connect(i3.sock, (struct sockaddr *)&addr, sizeof(addr)) < 0)
|
if (connect(i3.sock, (struct sockaddr *)&addr, sizeof(addr)) < 0)
|
||||||
{
|
{
|
||||||
DEBUG_ERROR("Failed to connect to the i3 IPC socket");
|
DEBUG_ERROR("Failed to connect to the i3 IPC socket");
|
||||||
|
Loading…
Reference in New Issue
Block a user