mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[FREELDR] Use RtlStringCbPrintfA instead of sprintf
Fixes GCC 8 warnings like: boot/freeldr/freeldr/disk/scsiport.c:806:31: error: 'partition(0)' directive writing 12 bytes into a region of size between 1 and 64 [-Werror=format-overflow=] sprintf(PartitionName, "%spartition(0)", ArcName); ^~~~~~~~~~~~ boot/freeldr/freeldr/disk/scsiport.c:806:5: note: 'sprintf' output between 13 and 76 bytes into a destination of size 64 sprintf(PartitionName, "%spartition(0)", ArcName); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
parent
791b1ad7bd
commit
8f050e66fd
4 changed files with 15 additions and 11 deletions
|
@ -803,7 +803,7 @@ SpiScanDevice(
|
|||
CHAR PartitionName[64];
|
||||
|
||||
/* Register device with partition(0) suffix */
|
||||
sprintf(PartitionName, "%spartition(0)", ArcName);
|
||||
RtlStringCbPrintfA(PartitionName, sizeof(PartitionName), "%spartition(0)", ArcName);
|
||||
FsRegisterDevice(PartitionName, &DiskVtbl);
|
||||
|
||||
/* Read device partition table */
|
||||
|
@ -817,8 +817,11 @@ SpiScanDevice(
|
|||
{
|
||||
if (PartitionBuffer->PartitionEntry[i].PartitionType != PARTITION_ENTRY_UNUSED)
|
||||
{
|
||||
sprintf(PartitionName, "%spartition(%lu)",
|
||||
ArcName, PartitionBuffer->PartitionEntry[i].PartitionNumber);
|
||||
RtlStringCbPrintfA(PartitionName,
|
||||
sizeof(PartitionName),
|
||||
"%spartition(%lu)",
|
||||
ArcName,
|
||||
PartitionBuffer->PartitionEntry[i].PartitionNumber);
|
||||
FsRegisterDevice(PartitionName, &DiskVtbl);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include <internal/hal.h>
|
||||
#include <drivers/pci/pci.h>
|
||||
#include <winerror.h>
|
||||
#include <ntstrsafe.h>
|
||||
#else
|
||||
#include <ntsup.h>
|
||||
#endif
|
||||
|
|
|
@ -341,7 +341,7 @@ BOOLEAN LinuxReadKernel(PFILE LinuxKernelFile)
|
|||
CHAR StatusText[260];
|
||||
PVOID LoadAddress;
|
||||
|
||||
sprintf(StatusText, "Loading %s", LinuxKernelName);
|
||||
RtlStringCbPrintfA(StatusText, sizeof(StatusText), "Loading %s", LinuxKernelName);
|
||||
UiDrawStatusText(StatusText);
|
||||
|
||||
/* Allocate memory for Linux kernel */
|
||||
|
@ -411,7 +411,7 @@ BOOLEAN LinuxReadInitrd(PFILE LinuxInitrdFile)
|
|||
ULONG BytesLoaded;
|
||||
CHAR StatusText[260];
|
||||
|
||||
sprintf(StatusText, "Loading %s", LinuxInitrdName);
|
||||
RtlStringCbPrintfA(StatusText, sizeof(StatusText), "Loading %s", LinuxInitrdName);
|
||||
UiDrawStatusText(StatusText);
|
||||
|
||||
// Allocate memory for the ramdisk
|
||||
|
|
|
@ -586,15 +586,15 @@ WinLdrScanRegistry(IN OUT PLIST_ENTRY BootDriverListHead,
|
|||
{
|
||||
TRACE_CH(REACTOS, "ImagePath: not found\n");
|
||||
TempImagePath[0] = 0;
|
||||
sprintf(ImagePath, "%s\\system32\\drivers\\%S.sys", DirectoryPath, ServiceName);
|
||||
RtlStringCbPrintfA(ImagePath, sizeof(ImagePath), "%s\\system32\\drivers\\%S.sys", DirectoryPath, ServiceName);
|
||||
}
|
||||
else if (TempImagePath[0] != L'\\')
|
||||
{
|
||||
sprintf(ImagePath, "%s%S", DirectoryPath, TempImagePath);
|
||||
RtlStringCbPrintfA(ImagePath, sizeof(ImagePath), "%s%S", DirectoryPath, TempImagePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(ImagePath, "%S", TempImagePath);
|
||||
RtlStringCbPrintfA(ImagePath, sizeof(ImagePath), "%S", TempImagePath);
|
||||
TRACE_CH(REACTOS, "ImagePath: '%s'\n", ImagePath);
|
||||
}
|
||||
|
||||
|
@ -666,15 +666,15 @@ WinLdrScanRegistry(IN OUT PLIST_ENTRY BootDriverListHead,
|
|||
{
|
||||
TRACE_CH(REACTOS, "ImagePath: not found\n");
|
||||
TempImagePath[0] = 0;
|
||||
sprintf(ImagePath, "%ssystem32\\drivers\\%S.sys", DirectoryPath, ServiceName);
|
||||
RtlStringCbPrintfA(ImagePath, sizeof(ImagePath), "%ssystem32\\drivers\\%S.sys", DirectoryPath, ServiceName);
|
||||
}
|
||||
else if (TempImagePath[0] != L'\\')
|
||||
{
|
||||
sprintf(ImagePath, "%s%S", DirectoryPath, TempImagePath);
|
||||
RtlStringCbPrintfA(ImagePath, sizeof(ImagePath), "%s%S", DirectoryPath, TempImagePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(ImagePath, "%S", TempImagePath);
|
||||
RtlStringCbPrintfA(ImagePath, sizeof(ImagePath), "%S", TempImagePath);
|
||||
TRACE_CH(REACTOS, "ImagePath: '%s'\n", ImagePath);
|
||||
}
|
||||
TRACE(" Adding boot driver: '%s'\n", ImagePath);
|
||||
|
|
Loading…
Reference in a new issue