Author: arty
Date: Fri Jan 16 17:44:29 2009
New Revision: 38801
URL:
http://svn.reactos.org/svn/reactos?rev=38801&view=rev
Log:
Prevent accessing NULL as a PE header when we have a bad file, found with Stefan100's
help
Modified:
trunk/reactos/boot/freeldr/freeldr/reactos/imageldr.c
Modified: trunk/reactos/boot/freeldr/freeldr/reactos/imageldr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/react…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/reactos/imageldr.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/reactos/imageldr.c [iso-8859-1] Fri Jan 16 17:44:29
2009
@@ -481,6 +481,11 @@
/* Get image headers */
NtHeader = RtlImageNtHeader(ReadBuffer);
+ if (!NtHeader)
+ {
+ DbgPrint("Failed to read image (bad PE signature) %s\n", Name);
+ return NULL;
+ }
/* Allocate memory for the driver */
ImageSize = NtHeader->OptionalHeader.SizeOfImage;