thii/DTTJailbreakDetection

DTTJailbreakDetection.m - Issue logic code

tranhieutt opened this issue · 6 comments

Hi Thi, please review source code below:

NSError *error = nil;
    NSString *string = @".";
    [string writeToFile:@"/private/jailbreak.txt" atomically:YES encoding:NSUTF8StringEncoding error:&error];
    if (!error) {
        return YES;
    } else {
        [fileManager removeItemAtPath:@"/private/jailbreak.txt" error:nil];
    }

If error = nil, it's mean string is written into path, so I think removeItemAtPath function should be write:

if (!error) {
        [fileManager removeItemAtPath:@"/private/jailbreak.txt" error:nil];
        return YES;

Am I right???

thii commented

Yes, you're right.

Coeur commented

And yet you close the issue without updating the code?

thii commented

To be honest I haven't touched this code in a while. Given the fact that it won't make any change to the logic, I thought it should be OK to leave it as is. I'm happy to take those changes if you could submit a PR.

Coeur commented

Well, I found that answer https://stackoverflow.com/a/26712383/1033581 got more updates than your repository. But I'm unable to confirm if any test is actually a good test of not, as I do not have any jailbroken device currently.

thii commented

This hasn't been updated for years because it just works already. The whole logic are just checking if the app can read or write outside of its sandbox.

Created a PR to fix this issue.