diff --git a/boot/freeldr/freeldr/lib/peloader.c b/boot/freeldr/freeldr/lib/peloader.c index 0b5ca0f87b2..935c0ee8212 100644 --- a/boot/freeldr/freeldr/lib/peloader.c +++ b/boot/freeldr/freeldr/lib/peloader.c @@ -245,9 +245,9 @@ PeLdrpBindImportName( ((ULONG_PTR)ForwarderName < ((ULONG_PTR)ExportDirectory + ExportSize))) { PLDR_DATA_TABLE_ENTRY DataTableEntry; - CHAR ForwardDllName[255]; PIMAGE_EXPORT_DIRECTORY RefExportDirectory; ULONG RefExportSize; + CHAR ForwardDllName[256]; TRACE("PeLdrpBindImportName(): ForwarderName %s\n", ForwarderName); @@ -255,7 +255,7 @@ PeLdrpBindImportName( RtlCopyMemory(ForwardDllName, ForwarderName, sizeof(ForwardDllName)); /* Strip out the symbol name */ - *strrchr(ForwardDllName,'.') = '\0'; + *strrchr(ForwardDllName, '.') = ANSI_NULL; /* Check if the target image is already loaded */ if (!PeLdrCheckForLoadedDll(ModuleListHead, ForwardDllName, &DataTableEntry)) @@ -264,7 +264,7 @@ PeLdrpBindImportName( if (strchr(ForwardDllName, '.') == NULL) { /* Name does not have an extension, append '.dll' */ - strcat(ForwardDllName, ".dll"); + RtlStringCbCatA(ForwardDllName, sizeof(ForwardDllName), ".dll"); } /* Now let's try to load it! */ @@ -351,8 +351,8 @@ PeLdrpLoadAndScanReferencedDll( PVOID BasePA = NULL; /* Prepare the full path to the file to be loaded */ - strcpy(FullDllName, DirectoryPath); - strcat(FullDllName, ImportName); + RtlStringCbCopyA(FullDllName, sizeof(FullDllName), DirectoryPath); + RtlStringCbCatA(FullDllName, sizeof(FullDllName), ImportName); TRACE("Loading referenced DLL: %s\n", FullDllName);