From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1792) id C6C673858039; Thu, 3 Aug 2023 20:47:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C6C673858039 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1691095648; bh=EGaCFrSoHBiJd4wWuBYppXdmG95RNjZANBiSc1e8pFc=; h=From:To:Subject:Date:From; b=veAIkDun3Wo2dePjWaExWCtR2bYI7uN8VyrCvEEb6lgIFEB6aSDmo7TCfBXFN2nkR g4vOH9dux1M6XVHnb0I7dLqJZ2HHDlOSgHrSR2nTnmpx1tcxBxTnttki70wg+J2mKV 8uaFFFsDuyMHRM3XVHp7ftWqE5Q9h3iUFTW9iADE= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Samuel Thibault To: glibc-cvs@sourceware.org Subject: [glibc] Subject: hurd: Make __realpath return EINVAL on NULL buf X-Act-Checkin: glibc X-Git-Author: Samuel Thibault X-Git-Refname: refs/heads/master X-Git-Oldrev: 5e4435f960bb681cbea853fb41043fabeeaea1b4 X-Git-Newrev: 2345bc44bb34f3eb6b49f4db3f0369573b892c3d Message-Id: <20230803204728.C6C673858039@sourceware.org> Date: Thu, 3 Aug 2023 20:47:28 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2345bc44bb34f3eb6b49f4db3f0369573b892c3d commit 2345bc44bb34f3eb6b49f4db3f0369573b892c3d Author: Samuel Thibault Date: Thu Aug 3 21:15:58 2023 +0200 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: --- debug/realpath_chk.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/debug/realpath_chk.c b/debug/realpath_chk.c index adfc09237c..8e734b534e 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. */