---
sysdeps/mach/hurd/readlinkat.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sysdeps/mach/hurd/readlinkat.c b/sysdeps/mach/hurd/readlinkat.c
index e0b1458f6c..d35922c605 100644
--- a/sysdeps/mach/hurd/readlinkat.c
+++ b/sysdeps/mach/hurd/readlinkat.c
@@ -65,7 +65,13 @@ __readlinkat (int fd, const char *file_name, char *buf,
size_t len)
if (err)
goto out;
+ if (__glibc_unlikely (nread > len)) /* Sanity check for bogus server.
*/
+ {
+ err = EGRATUITOUS;
+ goto out;
+ }
len = nread;
+
if (rbuf != buf)
{
memcpy (buf, rbuf, len);
--
2.53.0