aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-09-07 18:18:12 +0200
committerMattias Andrée <maandree@operamail.com>2015-09-07 18:18:12 +0200
commita65447e81444163986a6b7ebc5bb6820a98b5b6f (patch)
tree8fe8ec62748399c2e54ef4fe64b0127aaa72b741 /src/mds.c
parentdoc libmds_mpool (diff)
downloadmds-a65447e81444163986a6b7ebc5bb6820a98b5b6f.tar.gz
mds-a65447e81444163986a6b7ebc5bb6820a98b5b6f.tar.bz2
mds-a65447e81444163986a6b7ebc5bb6820a98b5b6f.tar.xz
fail if socket pathname is too long
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/mds.c')
-rw-r--r--src/mds.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/mds.c b/src/mds.c
index d9a4c9c..2a7e415 100644
--- a/src/mds.c
+++ b/src/mds.c
@@ -184,6 +184,8 @@ int main(int argc_, char** argv_)
/* Create display socket. */
xsnprintf(pathname, "%s/%u.socket", MDS_RUNTIME_ROOT_DIRECTORY, display);
address.sun_family = AF_UNIX;
+ if (strlen(pathname) >= sizeof(address.sun_path))
+ fail_if ((errno = ENAMETOOLONG));
strcpy(address.sun_path, pathname);
unlink(pathname);
fail_if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0);