From: Andrei Warkentin <andrey.warken...@gmail.com>

It is possible for the command line to be empty
(Cmd->TagHead.TagValueSize = 0), in which case the code should not
attempt to read the value at CommandLine[-1].

Signed-off-by: Pete Batard <p...@akeo.ie>
---
 Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c 
b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c
index 5a9d4c3f1787..9b4aa068857c 100644
--- a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c
+++ b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c
@@ -927,7 +927,8 @@ RpiFirmwareGetCommmandLine (
 
   CopyMem (CommandLine, Cmd->CommandLine, Cmd->TagHead.TagValueSize);
 
-  if (CommandLine[Cmd->TagHead.TagValueSize - 1] != '\0') {
+  if (Cmd->TagHead.TagValueSize == 0 ||
+      CommandLine[Cmd->TagHead.TagValueSize - 1] != '\0') {
     //
     // Add a NUL terminator if required.
     //
-- 
2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#49932): https://edk2.groups.io/g/devel/message/49932
Mute This Topic: https://groups.io/mt/41265683/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to