diff options
author | Pawel Jakub Dawidek <pjd@FreeBSD.org> | 2019-12-22 01:10:38 +0100 |
---|---|---|
committer | Martin Matuska <martin@matuska.org> | 2019-12-29 00:05:13 +0100 |
commit | 1dae5a549fe4ab99fd3a49a9edcf897a7b2b1844 (patch) | |
tree | 6dc76246beae6c3567b20b069bab1af75f408c4b /test_utils/test_main.c | |
parent | 4f085eea879e2be745f4d9bf57e8513ae48157f4 (diff) | |
download | libarchive-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/test_main.c')
-rw-r--r-- | test_utils/test_main.c | 2 |
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); |