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:
parent
88c4c6627b
commit
fb84047190
@ -549,11 +549,12 @@ list_entry(const char* file, const char* name = NULL)
|
|||||||
std::string nameSuffix;
|
std::string nameSuffix;
|
||||||
if (FSSH_S_ISLNK(mode)) {
|
if (FSSH_S_ISLNK(mode)) {
|
||||||
char buffer[FSSH_B_PATH_NAME_LENGTH];
|
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);
|
error = _kern_read_link(-1, file, buffer, &size);
|
||||||
if (error != FSSH_B_OK)
|
if (error != FSSH_B_OK)
|
||||||
snprintf(buffer, sizeof(buffer), "(%s)", fssh_strerror(error));
|
snprintf(buffer, sizeof(buffer), "(%s)", fssh_strerror(error));
|
||||||
|
|
||||||
|
buffer[size] = '\0';
|
||||||
nameSuffix += " -> ";
|
nameSuffix += " -> ";
|
||||||
nameSuffix += buffer;
|
nameSuffix += buffer;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user