mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 21:05:08 +00:00
libefivar: Check Length para before use in DevPathToTextUsbWWID
In function DevPathToTextUsbWWID, the Length parameter is used
without check. This patch is to add check before using it.
Upstream Bug: https://bugzilla.tianocore.org/show_bug.cgi?id=1336
Obtained from: d8e702693a
Pull Request: https://github.com/freebsd/freebsd-src/pull/581
This commit is contained in:
parent
c1fa6f4c5d
commit
e871598ad4
|
@ -1033,7 +1033,7 @@ DevPathToTextUsbWWID (
|
|||
|
||||
SerialNumberStr = (CHAR16 *) (&UsbWWId + 1);
|
||||
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…
Reference in a new issue