diff options
author | 2023-08-05 15:14:09 -0400 | |
---|---|---|
committer | 2023-08-05 16:08:10 -0400 | |
commit | 1c9a17d40de6dd3ea5b7aacaa76878357350881b (patch) | |
tree | f170cf8b8189382208c882b2261c19a81f1af9cb | |
parent | erealpath: drop unused path_max variable (diff) | |
download | sandbox-1c9a17d40de6dd3ea5b7aacaa76878357350881b.tar.gz sandbox-1c9a17d40de6dd3ea5b7aacaa76878357350881b.tar.bz2 sandbox-1c9a17d40de6dd3ea5b7aacaa76878357350881b.zip |
erealpath: leave space for a trailing '\0' in readlink's buffer
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
-rw-r--r-- | libsandbox/canonicalize.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libsandbox/canonicalize.c b/libsandbox/canonicalize.c index f282bdd..6c9a2d6 100644 --- a/libsandbox/canonicalize.c +++ b/libsandbox/canonicalize.c @@ -102,7 +102,7 @@ erealpath(const char *name, char *resolved) if (lstat64(rpath, &st)) break; if (S_ISLNK(st.st_mode)) { - ssize_t cnt = readlink(rpath, rpath, SB_PATH_MAX); + ssize_t cnt = readlink(rpath, rpath, SB_PATH_MAX - 1); if (cnt == -1) break; rpath[cnt] = '\0'; |