diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-09-07 18:18:12 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-09-07 18:18:12 +0200 |
commit | a65447e81444163986a6b7ebc5bb6820a98b5b6f (patch) | |
tree | 8fe8ec62748399c2e54ef4fe64b0127aaa72b741 /src/mds.c | |
parent | doc libmds_mpool (diff) | |
download | mds-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.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -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); |