OcDevicePathLib: Fix potential OOB access
@@ -160,7 +160,7 @@ TrailedBooterDevicePath (
&& IsDevicePathEnd (NextDevicePathNode (DevicePathWalker))) {
FilePath = (FILEPATH_DEVICE_PATH *) DevicePathWalker;
Length = OcFileDevicePathNameLen (FilePath);
-
+ if (Length > 0) {
if (FilePath->PathName[Length - 1] == L'\\') {
//
// Already appended, good. It should never be true with Apple entries though.
@@ -196,6 +196,7 @@ TrailedBooterDevicePath (
return NewDevicePath;
}
}
+ }
DevicePathWalker = NextDevicePathNode (DevicePathWalker);
}
