Revision: 16515
          http://sourceforge.net/p/edk2/code/16515
Author:   oliviermartin
Date:     2014-12-12 19:13:04 +0000 (Fri, 12 Dec 2014)
Log Message:
-----------
ArmPlatformPkg/Bds: Test if OptionalData is NULL before using it

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <[email protected]>

Modified Paths:
--------------
    trunk/edk2/ArmPlatformPkg/Bds/BootOption.c

Modified: trunk/edk2/ArmPlatformPkg/Bds/BootOption.c
===================================================================
--- trunk/edk2/ArmPlatformPkg/Bds/BootOption.c  2014-12-12 19:11:56 UTC (rev 
16514)
+++ trunk/edk2/ArmPlatformPkg/Bds/BootOption.c  2014-12-12 19:13:04 UTC (rev 
16515)
@@ -221,6 +221,8 @@
     WriteUnaligned32 ((UINT32 *)EfiLoadOptionPtr, 
ARM_BDS_OPTIONAL_DATA_SIGNATURE);
     WriteUnaligned32 ((UINT32 *)(EfiLoadOptionPtr + 4), BootType);
 
+    // OptionalData should have been initialized by the caller of this function
+    ASSERT (OptionalData != NULL);
     BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)OptionalData;
     SrcLinuxArguments = &(BootArguments->LinuxArguments);
     DestLinuxArguments = 
&((ARM_BDS_LOADER_OPTIONAL_DATA*)EfiLoadOptionPtr)->Arguments.LinuxArguments;
@@ -237,7 +239,9 @@
       CopyMem (InitrdPathListPtr, (VOID*)((UINTN)(SrcLinuxArguments + 1) + 
SrcLinuxArguments->CmdLineSize), SrcLinuxArguments->InitrdSize);
     }
   } else {
-    CopyMem (BootOption->OptionalData, OptionalData, OptionalDataSize);
+    if (OptionalData != NULL) {
+      CopyMem (BootOption->OptionalData, OptionalData, OptionalDataSize);
+    }
   }
   BootOption->OptionalDataSize = OptionalDataSize;
 


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to