From: Samuel Thibault Date: Thu, 3 Aug 2023 19:15:58 +0000 (+0200) Subject: Subject: hurd: Make __realpath return EINVAL on NULL buf X-Git-Tag: glibc-2.39~532 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2345bc44bb34f3eb6b49f4db3f0369573b892c3d;p=thirdparty%2Fglibc.git Subject: hurd: Make __realpath return EINVAL on NULL buf As Posix and stdlib/test-canon.c expects it, and rather than letting pathconf crash. --- diff --git a/debug/realpath_chk.c b/debug/realpath_chk.c index adfc09237cb..8e734b534e0 100644 --- a/debug/realpath_chk.c +++ b/debug/realpath_chk.c @@ -19,6 +19,7 @@ #include #include #include +#include char * @@ -30,7 +31,15 @@ __realpath_chk (const char *buf, char *resolved, size_t resolvedlen) return __realpath (buf, resolved); #else - long int pathmax =__pathconf (buf, _PC_PATH_MAX); + long int pathmax; + + if (buf == NULL) + { + __set_errno (EINVAL); + return NULL; + } + + pathmax = __pathconf (buf, _PC_PATH_MAX); if (pathmax != -1) { /* We do have a fixed limit. */