From 5d30d853295a5fe04cad22fdf649c5e0da6ded8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20B=C3=ADlka?= Date: Thu, 31 Oct 2013 13:58:01 +0100 Subject: Restrict shm_open and shm_unlink to SHMDIR. Fixes bugs 14752 and 15763. --- rt/tst-shm.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'rt') 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) -- cgit v1.2.1