diff options
-rw-r--r-- | libc/stdlib/realpath.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libc/stdlib/realpath.c b/libc/stdlib/realpath.c index b7c7ef413..aae8580a5 100644 --- a/libc/stdlib/realpath.c +++ b/libc/stdlib/realpath.c @@ -58,6 +58,14 @@ char resolved_path[]; int readlinks = 0; int n; + if (path == NULL) { + __set_errno(EINVAL); + return NULL; + } + if (*path == '\0') { + __set_errno(ENOENT); + return NULL; + } /* Make a copy of the source path since we may need to modify it. */ if (strlen(path) >= PATH_MAX - 2) { __set_errno(ENAMETOOLONG); |