Skip to content

Commit

Permalink
Fix initial bootstrap, fix oob access caused by off by one math error...
Browse files Browse the repository at this point in the history
  • Loading branch information
opa334 committed Mar 31, 2023
1 parent aa5deda commit 9ec278c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions BaseBin/jailbreakd/src/JBDTCPage.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#import "trustcache_structs.h"

// 743 cdhashes fit into one page
#define TC_ENTRY_COUNT_PER_PAGE 743
// 742 cdhashes fit into one page
#define TC_ENTRY_COUNT_PER_PAGE 742

@class JBDTCPage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,16 @@ class Bootstrapper {

static func wipeSymlink(atPath path: String) throws {
let fileManager = FileManager.default
let attributes = try fileManager.attributesOfItem(atPath: path)
if let fileType = attributes[.type] as? FileAttributeType, fileType == .typeSymbolicLink {
try fileManager.removeItem(atPath: path)
Logger.print("Deleted symlink at \(path)")
} else {
Logger.print("Wanted to delete symlink at \(path), but it is not a symlink")
do {
let attributes = try fileManager.attributesOfItem(atPath: path)
if let fileType = attributes[.type] as? FileAttributeType, fileType == .typeSymbolicLink {
try fileManager.removeItem(atPath: path)
Logger.print("Deleted symlink at \(path)")
} else {
Logger.print("Wanted to delete symlink at \(path), but it is not a symlink")
}
} catch let error as NSError {
Logger.print("Wanted to delete symlink at \(path), error occured: \(error), but we ignore it")
}
}

Expand Down

0 comments on commit 9ec278c

Please sign in to comment.