libbe_build: fix unterminated string in BEntry::set. Fixes #10686.

Signed-off-by: Stephan Aßmus <superstippi@gmx.de>
This commit is contained in:
Jessica Hamilton 2014-03-17 16:19:35 +00:00 committed by Stephan Aßmus
parent b167307526
commit 181948a678

View File

@ -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...
}