]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Validate the file descriptor argument to fallocate.
authorTom Hughes <tom@compton.nu>
Wed, 15 Jul 2009 07:47:49 +0000 (07:47 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 15 Jul 2009 07:47:49 +0000 (07:47 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10463

coregrind/m_syswrap/syswrap-linux.c

index cc14c9c5d973d73f88012c6a2c82b71fe5bd6984..32a68f7bc5c33de4fe87560355d47df6a1e7c03d 100644 (file)
@@ -1155,6 +1155,8 @@ PRE(sys_fallocate)
          ARG1, ARG2, (Long)ARG3, (Long)ARG4);
    PRE_REG_READ4(long, "fallocate",
                  int, fd, int, mode, vki_loff_t, offset, vki_loff_t, len);
+   if (!ML_(fd_allowed)(ARG1, "fallocate", tid, False))
+      SET_STATUS_Failure( VKI_EBADF );
 }
 
 /* ---------------------------------------------------------------------