mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-07 19:45:07 +02:00
MdePkg: check Length para before use in DevPathToTextUsbWWID
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1336 In function DevPathToTextUsbWWID, the Length parameter is used without check. This patch is to add check before using it. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
parent
63f151aadb
commit
d8e702693a
@ -972,7 +972,7 @@ DevPathToTextUsbWWID (
|
||||
|
||||
SerialNumberStr = (CHAR16 *) ((UINT8 *) UsbWWId + sizeof (USB_WWID_DEVICE_PATH));
|
||||
Length = (UINT16) ((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) UsbWWId) - sizeof (USB_WWID_DEVICE_PATH)) / sizeof (CHAR16));
|
||||
if (SerialNumberStr [Length - 1] != 0) {
|
||||
if (Length >= 1 && SerialNumberStr [Length - 1] != 0) {
|
||||
//
|
||||
// In case no NULL terminator in SerialNumber, create a new one with NULL terminator
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user