From 5f23ba4ac9c938fa6971ae07301cf120e1d45895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 8 Dec 2007 21:45:40 +0000 Subject: [PATCH] If either the path or the resolved path is NULL, realpath() now returns EINVAL. This also fixes bug #1659. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23087 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/libroot/posix/stdlib/realpath.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/system/libroot/posix/stdlib/realpath.c b/src/system/libroot/posix/stdlib/realpath.c index 8c5a3187da..5b4b93a12f 100644 --- a/src/system/libroot/posix/stdlib/realpath.c +++ b/src/system/libroot/posix/stdlib/realpath.c @@ -58,6 +58,11 @@ realpath(const char *path, char *resolved) char *p, *q, wbuf[MAXPATHLEN]; int symlinks = 0; + if (path == NULL || resolved == NULL) { + errno = EINVAL; + return NULL; + } + /* Save the starting point. */ if ((fd = open(".", O_RDONLY)) < 0) { strcpy(resolved, ".");