aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/elementary
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2018-11-07 15:22:48 +0000
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2018-11-09 11:43:59 +0000
commitfdde914bacb545c225745031056cae7a8425cef1 (patch)
treede4bb8ef4eeb100e0fe14147bd6e6e203300d5c2 /src/bin/elementary
parentelm prefs cc - warn - use memcpy instead since we are really truncating (diff)
downloadefl-fdde914bacb545c225745031056cae7a8425cef1.tar.gz
elm quicklaunch - warn - explicitly handle socket length being too long
make socket too long an error. fixes warning.
Diffstat (limited to 'src/bin/elementary')
-rw-r--r--src/bin/elementary/quicklaunch.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/bin/elementary/quicklaunch.c b/src/bin/elementary/quicklaunch.c
index d23287e32e..2b6378a04d 100644
--- a/src/bin/elementary/quicklaunch.c
+++ b/src/bin/elementary/quicklaunch.c
@@ -183,6 +183,7 @@ main(int argc, char **argv)
struct sigaction action;
const char *domain;
int ret = 0;
+ size_t len;
if (!eina_init())
{
@@ -237,7 +238,14 @@ main(int argc, char **argv)
exit(-1);
}
socket_unix.sun_family = AF_UNIX;
- strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path));
+ len = strlen(buf);
+ if (len > sizeof(socket_unix.sun_path))
+ {
+ CRI("socket path '%s' is too long for buffer", buf);
+ exit(-1);
+ }
+ memcpy(socket_unix.sun_path, buf, len);
+ if (len < sizeof(socket_unix.sun_path)) socket_unix.sun_path[len] = 0;
socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix);
if (bind(sock, (struct sockaddr *)&socket_unix, socket_unix_len) < 0)
{