about summary refs log tree commit diff
path: root/debug
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2023-08-03 21:15:58 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-08-03 22:42:29 +0200
commit2345bc44bb34f3eb6b49f4db3f0369573b892c3d (patch)
tree4d0748b7ce2bb433eca698a1e6d12aea4fd4e241 /debug
parent5e4435f960bb681cbea853fb41043fabeeaea1b4 (diff)
downloadglibc-2345bc44bb34f3eb6b49f4db3f0369573b892c3d.tar.gz
glibc-2345bc44bb34f3eb6b49f4db3f0369573b892c3d.tar.xz
glibc-2345bc44bb34f3eb6b49f4db3f0369573b892c3d.zip
Subject: hurd: Make __realpath return EINVAL on NULL buf
As Posix and stdlib/test-canon.c expects it, and rather than letting
pathconf crash.
Diffstat (limited to 'debug')
-rw-r--r--debug/realpath_chk.c11
1 files changed, 10 insertions, 1 deletions
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 <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <errno.h>
 
 
 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.  */