diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-09-27 09:02:53 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-09-27 10:15:42 +0200 |
commit | 9470db92f47ce79ad18c3476561119d428f81c65 (patch) | |
tree | 9a26229fc106c290072b051589a426251e5a7824 /Libraries | |
parent | f28fa616ebb657c7b094c24524dde5349ae61da2 (diff) | |
download | serenity-9470db92f47ce79ad18c3476561119d428f81c65.zip |
LibC: realpath() should assume the buffer is PATH_MAX bytes
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibC/unistd.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/Libraries/LibC/unistd.cpp b/Libraries/LibC/unistd.cpp index 831f9c99ad..d465792cab 100644 --- a/Libraries/LibC/unistd.cpp +++ b/Libraries/LibC/unistd.cpp @@ -591,13 +591,9 @@ int umount(const char* mountpoint) char* realpath(const char* pathname, char* buffer) { - size_t size; - if (buffer == nullptr) { - size = PATH_MAX; + size_t size = PATH_MAX; + if (buffer == nullptr) buffer = (char*)malloc(size); - } else { - size = sizeof(buffer); - } int rc = syscall(SC_realpath, pathname, buffer, size); if (rc < 0) { errno = -rc; |