[ros-diffs] [hpoussin] 46190: [freeldr] Never suppose that buffer in UNICODE_STRING is null terminated. Fixes some random failures when loading drivers

hpoussin at svn.reactos.org hpoussin at svn.reactos.org
Sat Mar 13 23:56:41 CET 2010


Author: hpoussin
Date: Sat Mar 13 23:56:41 2010
New Revision: 46190

URL: http://svn.reactos.org/svn/reactos?rev=46190&view=rev
Log:
[freeldr] Never suppose that buffer in UNICODE_STRING is null terminated. Fixes some random failures when loading drivers

Modified:
    trunk/reactos/boot/freeldr/freeldr/windows/winldr.c

Modified: trunk/reactos/boot/freeldr/freeldr/windows/winldr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/windows/winldr.c?rev=46190&r1=46189&r2=46190&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/windows/winldr.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/windows/winldr.c [iso-8859-1] Sat Mar 13 23:56:41 2010
@@ -232,7 +232,7 @@
 	PVOID DriverBase;
 
 	// Separate the path to file name and directory path
-	sprintf(DriverPath, "%S", FilePath->Buffer);
+	snprintf(DriverPath, sizeof(DriverPath), "%wZ", FilePath);
 	DriverNamePos = strrchr(DriverPath, '\\');
 	if (DriverNamePos != NULL)
 	{
@@ -261,7 +261,7 @@
 	}
 
 	// It's not loaded, we have to load it
-	sprintf(FullPath,"%s%S", BootPath, FilePath->Buffer);
+	snprintf(FullPath, sizeof(FullPath), "%s%wZ", BootPath, FilePath);
 	Status = WinLdrLoadImage(FullPath, LoaderBootDriver, &DriverBase);
 	if (!Status)
 		return FALSE;




More information about the Ros-diffs mailing list