Skip to content

Commit

Permalink
Fix launchd crash
Browse files Browse the repository at this point in the history
  • Loading branch information
opa334 committed Feb 19, 2024
1 parent 404d425 commit 2179ffd
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions BaseBin/libjailbreak/src/signatures.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ bool csd_superblob_is_adhoc_signed(CS_DecodedSuperBlob *superblob)
NSString *(^resolveLoaderExecutablePaths)(NSString *) = ^NSString *(NSString *candidatePath) {
if (!candidatePath) return nil;
if ([[NSFileManager defaultManager] fileExistsAtPath:candidatePath]) return candidatePath;
if ([candidatePath hasPrefix:@"@loader_path"]) {
if ([candidatePath hasPrefix:@"@loader_path"] && loaderPath) {
NSString *loaderCandidatePath = [candidatePath stringByReplacingOccurrencesOfString:@"@loader_path" withString:loaderPath];
if ([[NSFileManager defaultManager] fileExistsAtPath:loaderCandidatePath]) return loaderCandidatePath;
}
if ([candidatePath hasPrefix:@"@executable_path"]) {
if ([candidatePath hasPrefix:@"@executable_path"] && executablePath) {
NSString *executableCandidatePath = [candidatePath stringByReplacingOccurrencesOfString:@"@executable_path" withString:executablePath];
if ([[NSFileManager defaultManager] fileExistsAtPath:executableCandidatePath]) return executableCandidatePath;
}
Expand All @@ -83,11 +83,14 @@ bool csd_superblob_is_adhoc_signed(CS_DecodedSuperBlob *superblob)
MachO *macho = ljb_fat_find_preferred_slice(fat);
if (macho) {
macho_enumerate_rpaths(macho, ^(const char *rpathC, bool *stop) {
if (!rpathC) return;
NSString *rpath = [NSString stringWithUTF8String:rpathC];
rpathResolvedPath = resolveLoaderExecutablePaths([dylibPath stringByReplacingOccurrencesOfString:@"@rpath" withString:rpath]);
if (rpathResolvedPath) {
*stop = true;
if (rpathC) {
NSString *rpath = [NSString stringWithUTF8String:rpathC];
if (rpath) {
rpathResolvedPath = resolveLoaderExecutablePaths([dylibPath stringByReplacingOccurrencesOfString:@"@rpath" withString:rpath]);
if (rpathResolvedPath) {
*stop = true;
}
}
}
});
}
Expand Down

0 comments on commit 2179ffd

Please sign in to comment.