helper: Correctly zero terminate symlink targets

tingping/wmclass
Alexander Larsson 2015-10-05 11:24:26 +02:00
parent 3499f3bfe9
commit dbc92635cc
1 changed files with 2 additions and 1 deletions

View File

@ -1433,9 +1433,10 @@ link_extra_etc_dirs ()
ssize_t r;
target = xmalloc (st.st_size + 1);
r = readlink (dst_path, target, st.st_size + 1);
r = readlink (dst_path, target, st.st_size);
if (r == -1)
die_with_error ("readlink %s", dst_path);
target[r] = 0;
}
else
target = strconcat ("/usr/etc/", dirent->d_name);