From: Hervé Poussineau Date: Sat, 13 Mar 2010 22:56:41 +0000 (+0000) Subject: [freeldr] Never suppose that buffer in UNICODE_STRING is null terminated. Fixes some... X-Git-Tag: backups/header-work@57446~118^2~43 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=9a46a4601184cbd1312674dde8bedddd34c0678e [freeldr] Never suppose that buffer in UNICODE_STRING is null terminated. Fixes some random failures when loading drivers svn path=/trunk/; revision=46190 --- diff --git a/reactos/boot/freeldr/freeldr/windows/winldr.c b/reactos/boot/freeldr/freeldr/windows/winldr.c index 4ba7b1bcb29..f3f7cd199b7 100644 --- a/reactos/boot/freeldr/freeldr/windows/winldr.c +++ b/reactos/boot/freeldr/freeldr/windows/winldr.c @@ -232,7 +232,7 @@ WinLdrLoadDeviceDriver(PLOADER_PARAMETER_BLOCK LoaderBlock, 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 @@ WinLdrLoadDeviceDriver(PLOADER_PARAMETER_BLOCK LoaderBlock, } // 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;