[hurd, commited] hurd: Make readlinkat check bogus length returned by translator (BZ 34504)

Samuel Thibault <[email protected]>
Newsgroups gmane.os.hurd.cvs,gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
---
 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.