OcMachoLib: Consider the LC buffer might be padded when retrieving the next.
@@ -183,7 +183,8 @@ InternalGetNextCommand64 (
for (
;
- (UINTN)Command < TopOfCommands;
+ ((UINTN)Command + sizeof (MACH_LOAD_COMMAND)) < TopOfCommands
+ && ((UINTN)Command + Command->CommandSize) < TopOfCommands;
Command = NEXT_MACH_LOAD_COMMAND (Command)
) {
if (Command->CommandType == LoadCommandType) {
