about summary refs log tree commit diff
path: root/rt/tst-shm.c
diff options
context:
space:
mode:
authorOndřej Bílka <neleai@seznam.cz>2013-10-31 13:58:01 +0100
committerOndřej Bílka <neleai@seznam.cz>2013-10-31 13:59:01 +0100
commit5d30d853295a5fe04cad22fdf649c5e0da6ded8c (patch)
tree9428bf5c8d81db0efbc55c3e51cc0fe94244fb51 /rt/tst-shm.c
parent8a43e768d9404c64e0d98d7a54871abad427fd69 (diff)
downloadglibc-5d30d853295a5fe04cad22fdf649c5e0da6ded8c.tar.gz
glibc-5d30d853295a5fe04cad22fdf649c5e0da6ded8c.tar.xz
glibc-5d30d853295a5fe04cad22fdf649c5e0da6ded8c.zip
Restrict shm_open and shm_unlink to SHMDIR. Fixes bugs 14752 and 15763.
Diffstat (limited to 'rt/tst-shm.c')
-rw-r--r--rt/tst-shm.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/rt/tst-shm.c b/rt/tst-shm.c
index f9d5ab0098..cb4b1ee764 100644
--- a/rt/tst-shm.c
+++ b/rt/tst-shm.c
@@ -134,6 +134,14 @@ do_test (void)
   int status2;
   struct stat64 st;
 
+  fd = shm_open ("/../escaped", O_RDWR | O_CREAT | O_TRUNC | O_EXCL, 0600);
+  if (fd != -1)
+    {
+      perror ("read file outside of SHMDIR directory");
+      return 1;
+    }
+
+
   /* Create the shared memory object.  */
   fd = shm_open ("/shm-test", O_RDWR | O_CREAT | O_TRUNC | O_EXCL, 0600);
   if (fd == -1)