From 181948a6787802cc2795b739d6f32681968e27c2 Mon Sep 17 00:00:00 2001 From: Jessica Hamilton Date: Mon, 17 Mar 2014 16:19:35 +0000 Subject: [PATCH] libbe_build: fix unterminated string in BEntry::set. Fixes #10686. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stephan Aßmus --- src/build/libbe/storage/Entry.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/build/libbe/storage/Entry.cpp b/src/build/libbe/storage/Entry.cpp index 2f6accfdaa..93dd8f837b 100644 --- a/src/build/libbe/storage/Entry.cpp +++ b/src/build/libbe/storage/Entry.cpp @@ -985,10 +985,11 @@ BEntry::set(int dirFD, const char *path, bool traverse) // we need to traverse the symlink if (--linkLimit < 0) return B_LINK_LIMIT; - size_t bufferSize = B_PATH_NAME_LENGTH; + size_t bufferSize = B_PATH_NAME_LENGTH - 1; error = _kern_read_link(dirFD, leafName, tmpPath, &bufferSize); if (error < 0) return error; + tmpPath[bufferSize] = '\0'; path = tmpPath; // next round... }