Null-terminate the _kern_read_link() result.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24587 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2008-03-26 04:18:40 +00:00
parent 88c4c6627b
commit fb84047190

View File

@ -549,11 +549,12 @@ list_entry(const char* file, const char* name = NULL)
std::string nameSuffix;
if (FSSH_S_ISLNK(mode)) {
char buffer[FSSH_B_PATH_NAME_LENGTH];
fssh_size_t size = sizeof(buffer);
fssh_size_t size = sizeof(buffer) - 1;
error = _kern_read_link(-1, file, buffer, &size);
if (error != FSSH_B_OK)
snprintf(buffer, sizeof(buffer), "(%s)", fssh_strerror(error));
buffer[size] = '\0';
nameSuffix += " -> ";
nameSuffix += buffer;
}