summaryrefslogtreecommitdiff
path: root/test_utils
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2019-12-22 01:10:38 +0100
committerMartin Matuska <martin@matuska.org>2019-12-29 00:05:13 +0100
commit1dae5a549fe4ab99fd3a49a9edcf897a7b2b1844 (patch)
tree6dc76246beae6c3567b20b069bab1af75f408c4b /test_utils
parent4f085eea879e2be745f4d9bf57e8513ae48157f4 (diff)
downloadlibarchive-1dae5a549fe4ab99fd3a49a9edcf897a7b2b1844.tar.gz
Fix possible off-by-one when dealing with readlink(2)
readlink(2) and readlinkat(2) don't append a null byte to the given buffer.
Diffstat (limited to 'test_utils')
-rw-r--r--test_utils/test_main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/test_utils/test_main.c b/test_utils/test_main.c
index 1b9af9a9..1b44edf1 100644
--- a/test_utils/test_main.c
+++ b/test_utils/test_main.c
@@ -1863,7 +1863,7 @@ is_symlink(const char *file, int line,
return (0);
if (contents == NULL)
return (1);
- linklen = readlink(pathname, buff, sizeof(buff));
+ linklen = readlink(pathname, buff, sizeof(buff) - 1);
if (linklen < 0) {
failure_start(file, line, "Can't read symlink %s", pathname);
failure_finish(NULL);