_kern_read_link() no longer null-terminates the read string. Fixes
loading of symlinked libraries. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24467 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -139,13 +139,14 @@ try_open_executable(const char *dir, int dirLength, const char *name,
|
|||||||
|
|
||||||
if (S_ISLNK(stat.st_mode)) {
|
if (S_ISLNK(stat.st_mode)) {
|
||||||
char buffer[PATH_MAX];
|
char buffer[PATH_MAX];
|
||||||
size_t length = PATH_MAX;
|
size_t length = PATH_MAX - 1;
|
||||||
char *lastSlash;
|
char *lastSlash;
|
||||||
|
|
||||||
// it's a link, indeed
|
// it's a link, indeed
|
||||||
status = _kern_read_link(-1, path, buffer, &length);
|
status = _kern_read_link(-1, path, buffer, &length);
|
||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
buffer[length] = '\0';
|
||||||
|
|
||||||
lastSlash = strrchr(path, '/');
|
lastSlash = strrchr(path, '/');
|
||||||
if (buffer[0] != '/' && lastSlash != NULL) {
|
if (buffer[0] != '/' && lastSlash != NULL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user