Author: hbelusca
Date: Tue Jul 12 22:30:55 2016
New Revision: 71911
URL:
http://svn.reactos.org/svn/reactos?rev=71911&view=rev
Log:
[USETUP]
- Don't hardcode buffer string size in GetPartTypeStringFromPartitionType calls.
- Possibly check whether the first character of the PartTypeString string is NULL before
printing a generic partition information in case the partition type is unknown. We might
check instead for the STRING_FORMATUNKNOWN string...
- Don't check for PartTypeString being NULL since it's not a pointer. CID #1363481
and CID #1363494.
Modified:
trunk/reactos/base/setup/usetup/interface/usetup.c
trunk/reactos/base/setup/usetup/partlist.c
Modified: trunk/reactos/base/setup/usetup/interface/usetup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/interfac…
==============================================================================
--- trunk/reactos/base/setup/usetup/interface/usetup.c [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/interface/usetup.c [iso-8859-1] Tue Jul 12 22:30:55
2016
@@ -2403,7 +2403,7 @@
ULONGLONG DiskSize;
ULONGLONG PartSize;
PCHAR Unit;
- CHAR PartType[32];
+ CHAR PartTypeString[32];
if (PartitionList == NULL ||
PartitionList->CurrentDisk == NULL ||
@@ -2418,7 +2418,9 @@
MUIDisplayPage(DELETE_PARTITION_PAGE);
- GetPartTypeStringFromPartitionType(PartEntry->PartitionType, PartType, 30);
+ GetPartTypeStringFromPartitionType(PartEntry->PartitionType,
+ PartTypeString,
+ ARRAYSIZE(PartTypeString));
PartSize = PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector;
#if 0
@@ -2440,7 +2442,7 @@
Unit = MUIGetString(STRING_KB);
}
- if (PartType == NULL)
+ if (*PartTypeString == '\0') // STRING_FORMATUNKNOWN ??
{
CONSOLE_PrintTextXY(6, 10,
MUIGetString(STRING_HDDINFOUNK2),
@@ -2456,7 +2458,7 @@
" %c%c %s %I64u %s",
(PartEntry->DriveLetter == 0) ? '-' :
PartEntry->DriveLetter,
(PartEntry->DriveLetter == 0) ? '-' :
':',
- PartType,
+ PartTypeString,
PartSize,
Unit);
}
@@ -2696,7 +2698,9 @@
}
/* adjust partition type */
- GetPartTypeStringFromPartitionType(PartEntry->PartitionType, PartTypeString, 30);
+ GetPartTypeStringFromPartitionType(PartEntry->PartitionType,
+ PartTypeString,
+ ARRAYSIZE(PartTypeString));
if (PartEntry->AutoCreate == TRUE)
{
@@ -2707,7 +2711,7 @@
PartEntry->PartitionNumber,
PartSize,
PartUnit,
- PartType);
+ PartTypeString);
#endif
CONSOLE_PrintTextXY(8, 10, MUIGetString(STRING_HDINFOPARTZEROED),
@@ -2750,7 +2754,7 @@
{
CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_INSTALLONPART));
- if (PartTypeString == NULL)
+ if (*PartTypeString == '\0') // STRING_FORMATUNKNOWN ??
{
CONSOLE_PrintTextXY(8, 10,
MUIGetString(STRING_HDDINFOUNK4),
Modified: trunk/reactos/base/setup/usetup/partlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/partlist…
==============================================================================
--- trunk/reactos/base/setup/usetup/partlist.c [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/partlist.c [iso-8859-1] Tue Jul 12 22:30:55 2016
@@ -1672,7 +1672,7 @@
{
GetPartTypeStringFromPartitionType(PartEntry->PartitionType,
PartTypeString,
- 30);
+ ARRAYSIZE(PartTypeString));
PartType = PartTypeString;
}