From: GNU Libc Maintainers Date: Mon, 10 Jun 2024 20:25:19 +0000 (+0200) Subject: git-realpath_NULL X-Git-Tag: archive/raspbian/2.38-13+rpi1^2~82 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=cd77a614f0fb1cd0a1a9e85881c9e19afa7439a4;p=glibc.git git-realpath_NULL 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. Gbp-Pq: Topic hurd-i386 Gbp-Pq: Name git-realpath_NULL.diff --- diff --git a/debug/realpath_chk.c b/debug/realpath_chk.c index adfc09237..8e734b534 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. */