Skip to content

Commit

Permalink
Handle full name for symbol in PatcherGetSymbolAddress.
Browse files Browse the repository at this point in the history
  • Loading branch information
jief666 committed Jun 19, 2022
1 parent 58da8df commit 8aa646b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Library/OcAppleKernelLib/KextPatcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ PatcherGetSymbolAddress (
UINT64 SymbolAddress;
UINT32 Offset;
UINT32 Index;
BOOLEAN FullName = FALSE;

FullName = (Name[0] == '_' && Name[1] == '_');

Index = 0;
Offset = 0;
Expand Down Expand Up @@ -256,7 +259,10 @@ PatcherGetSymbolAddress (
}

SymbolName = MachoGetSymbolName (&Context->MachContext, Symbol);
if ((SymbolName != NULL) && (AsciiStrCmp (Name, SymbolName) == 0)) {
// if ((SymbolName != NULL) && (AsciiStrCmp (Name, SymbolName) == 0)) {
if (SymbolName != NULL &&
(( FullName && AsciiStrCmp (Name, SymbolName) == 0) ||
(!FullName && AsciiStrStr (SymbolName, Name) != NULL))) {
//
// Once we have a symbol, get its ondisk offset.
//
Expand Down

0 comments on commit 8aa646b

Please sign in to comment.