summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2018-06-21 17:15:32 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2018-06-21 17:15:32 -0700
commit8daf9c69db65495af9601bf008028d8c2fa8281a (patch)
tree0ec93da9f11d622eddf1418a2b172b9c51886281
parent7a7ddaaa837f2e9efc279ff3397ea54a17b919a4 (diff)
parentd4704e5924ae50e223cf98e33e6e3ed1578a3033 (diff)
Merge "QcomModulePkg: Fix the array index out of bounds error"
-rw-r--r--QcomModulePkg/Library/FastbootLib/FastbootCmds.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/QcomModulePkg/Library/FastbootLib/FastbootCmds.c b/QcomModulePkg/Library/FastbootLib/FastbootCmds.c
index 36540cf2a..70d804352 100644
--- a/QcomModulePkg/Library/FastbootLib/FastbootCmds.c
+++ b/QcomModulePkg/Library/FastbootLib/FastbootCmds.c
@@ -1219,7 +1219,7 @@ HandleMetaImgFlash (IN CHAR16 *PartitionName,
}
AsciiStrToUnicodeStr (img_header_entry[i].ptn_name, PartitionNameFromMeta);
Status = HandleRawImgFlash (
- PartitionNameFromMeta, sizeof (PartitionNameFromMeta),
+ PartitionNameFromMeta, ARRAY_SIZE (PartitionNameFromMeta),
(void *)Image + img_header_entry[i].start_offset,
img_header_entry[i].size);
if (Status != EFI_SUCCESS) {
@@ -1649,7 +1649,8 @@ CmdFlash (IN CONST CHAR8 *arg, IN VOID *data, IN UINT32 sz)
MultiSlotBoot = PartitionHasMultiSlot ((CONST CHAR16 *)L"boot");
if (MultiSlotBoot) {
- HasSlot = GetPartitionHasSlot (PartitionName, sizeof (PartitionName),
+ HasSlot = GetPartitionHasSlot (PartitionName,
+ ARRAY_SIZE (PartitionName),
SlotSuffix, MAX_SLOT_SUFFIX_SZ);
if (HasSlot) {
DEBUG ((EFI_D_VERBOSE, "Partition %s has slot\n", PartitionName));
@@ -1679,23 +1680,26 @@ CmdFlash (IN CONST CHAR8 *arg, IN VOID *data, IN UINT32 sz)
}
}
- FlashResult = HandleSparseImgFlash (PartitionName, sizeof (PartitionName),
+ FlashResult = HandleSparseImgFlash (PartitionName,
+ ARRAY_SIZE (PartitionName),
mFlashDataBuffer, mFlashNumDataBytes);
IsFlashComplete = TRUE;
StopUsbTimer ();
} else if (!AsciiStrnCmp (UbiHeader->HdrMagic, UBI_HEADER_MAGIC, 4)) {
FlashResult = HandleUbiImgFlash (PartitionName,
- sizeof (PartitionName),
+ ARRAY_SIZE (PartitionName),
mFlashDataBuffer,
mFlashNumDataBytes);
} else if (meta_header->magic == META_HEADER_MAGIC) {
- FlashResult = HandleMetaImgFlash (PartitionName, sizeof (PartitionName),
+ FlashResult = HandleMetaImgFlash (PartitionName,
+ ARRAY_SIZE (PartitionName),
mFlashDataBuffer, mFlashNumDataBytes);
} else {
- FlashResult = HandleRawImgFlash (PartitionName, sizeof (PartitionName),
+ FlashResult = HandleRawImgFlash (PartitionName,
+ ARRAY_SIZE (PartitionName),
mFlashDataBuffer, mFlashNumDataBytes);
}
@@ -1796,7 +1800,7 @@ CmdErase (IN CONST CHAR8 *arg, IN VOID *data, IN UINT32 sz)
* implementation
*/
if (MultiSlotBoot)
- HasSlot = GetPartitionHasSlot (PartitionName, sizeof (PartitionName),
+ HasSlot = GetPartitionHasSlot (PartitionName, ARRAY_SIZE (PartitionName),
SlotSuffix, MAX_SLOT_SUFFIX_SZ);
// Build output string