mirror of
https://github.com/Metabolix/HackBGRT.git
synced 2025-12-06 17:15:42 -08:00
Detect device paths which contain extra data
Apparently some firmware may add extra data to the device path, so exit the loop on the first end-of-path record. Fixes GH issue #181.
This commit is contained in:
@@ -99,7 +99,13 @@ public class Efi {
|
|||||||
if (len < 4 || pos + len > pathNodesEnd) {
|
if (len < 4 || pos + len > pathNodesEnd) {
|
||||||
return; // throw new Exception("Bad entry.");
|
return; // throw new Exception("Bad entry.");
|
||||||
}
|
}
|
||||||
DevicePathNodes.Add(new DevicePathNode(data.Skip(pos).Take(len).ToArray()));
|
var node = new DevicePathNode(data.Skip(pos).Take(len).ToArray());
|
||||||
|
DevicePathNodes.Add(node);
|
||||||
|
if (node.Type == 0x7f && node.SubType == 0xff) {
|
||||||
|
// End of entire device path.
|
||||||
|
// Apparently some firmwares produce paths with unused nodes at the end.
|
||||||
|
break;
|
||||||
|
}
|
||||||
pos += len;
|
pos += len;
|
||||||
}
|
}
|
||||||
Arguments = data.Skip(pathNodesEnd).ToArray();
|
Arguments = data.Skip(pathNodesEnd).ToArray();
|
||||||
|
|||||||
Reference in New Issue
Block a user