]> git.proxmox.com Git - mirror_edk2.git/commit
OvmfPkg/X86QemuLoadImageLib: Handle allocation failure for CommandLine
authorMartin Radev <martin.b.radev@gmail.com>
Thu, 18 Mar 2021 21:44:17 +0000 (22:44 +0100)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 19 Mar 2021 18:13:51 +0000 (18:13 +0000)
commitca318882714080fb81fe9eb89a7b7934efc5bfae
tree93eb174558ae726e910a75873d1186a146dafc7a
parenteb07bfb09ef5483ad58ed0eba713f32fb0c909f9
OvmfPkg/X86QemuLoadImageLib: Handle allocation failure for CommandLine

The CommandLine and InitrdData may be set to NULL if the provided
size is too large. Because the zero page is mapped, this would not
cause an immediate crash but can lead to memory corruption instead.
This patch just adds validation and returns error if either allocation
has failed.

Signed-off-by: Martin Radev <martin.b.radev@gmail.com>
Message-Id: <YFPJsaGzVWQxoEU4@martin-ThinkPad-T440p>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
[lersek@redhat.com: drop unnecessary empty line from code; remove personal
 (hence likely unstable) repo reference from commit message]
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c