LibC: realpath() should assume the buffer is PATH_MAX bytes

This commit is contained in:
Andreas Kling 2019-09-27 09:02:53 +02:00
commit 9470db92f4
Notes: sideshowbarker 2024-07-19 11:59:12 +09:00

View file

@ -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;