From 3a31604b7de10bd60ea2e11b804cad22e253a2bb Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Sat, 28 Aug 2004 22:18:24 +0000 Subject: [PATCH] - Mapping zero-sized files is prohibited. svn path=/trunk/; revision=10727 --- reactos/ntoskrnl/mm/section.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/mm/section.c b/reactos/ntoskrnl/mm/section.c index 2280f302aba..fea613f5c27 100644 --- a/reactos/ntoskrnl/mm/section.c +++ b/reactos/ntoskrnl/mm/section.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: section.c,v 1.161 2004/08/23 22:29:43 hbirr Exp $ +/* $Id: section.c,v 1.162 2004/08/28 22:18:24 navaraf Exp $ * * PROJECT: ReactOS kernel * FILE: ntoskrnl/mm/section.c @@ -2346,6 +2346,13 @@ MmCreateDataFileSection(PSECTION_OBJECT *SectionObject, else { MaximumSize = FileInfo.EndOfFile; + /* Mapping zero-sized files isn't allowed. */ + if (MaximumSize.QuadPart == 0) + { + ObDereferenceObject(Section); + ObDereferenceObject(FileObject); + return STATUS_FILE_INVALID; + } } if (MaximumSize.QuadPart > FileInfo.EndOfFile.QuadPart)