From 485443bfcaa02b728bc278fb2e4c08d907781752 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 10 Jan 2020 21:26:47 +0100 Subject: Kernel: Pass characters+length to link() --- Libraries/LibC/unistd.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Libraries/LibC') diff --git a/Libraries/LibC/unistd.cpp b/Libraries/LibC/unistd.cpp index 8d63256b4a..da27a3b0e9 100644 --- a/Libraries/LibC/unistd.cpp +++ b/Libraries/LibC/unistd.cpp @@ -339,7 +339,12 @@ off_t lseek(int fd, off_t offset, int whence) int link(const char* old_path, const char* new_path) { - int rc = syscall(SC_link, old_path, new_path); + if (!old_path || !new_path) { + errno = EFAULT; + return -1; + } + Syscall::SC_link_params params { { old_path, strlen(old_path) }, { new_path, strlen(new_path) } }; + int rc = syscall(SC_link, ¶ms); __RETURN_WITH_ERRNO(rc, rc, -1); } -- cgit v1.2.3