diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2014-05-14 04:36:12 -0700 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2014-05-14 04:36:12 -0700 |
commit | 2595e4c379a0a75854a02dd9fc68dae99c274434 (patch) | |
tree | 502f9c2c542d4f3353d798573f7652fe96982307 /MobileCydia.mm | |
parent | 299aeacd7d337a1e57ca14660a151f5a9fd453e2 (diff) |
Do not allow invalid APT config lines as sources.
Diffstat (limited to 'MobileCydia.mm')
-rw-r--r-- | MobileCydia.mm | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm index e0539fa..b8504f4 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -8454,6 +8454,22 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi case 1: { NSString *href = [[alert textField] text]; + static Pcre href_r("^http(s?)://[^# ]*$"); + if (!href_r(href)) { + UIAlertView *alert = [[[UIAlertView alloc] + initWithTitle:Error_ + message:UCLocalize("INVALID_URL") + delegate:self + cancelButtonTitle:UCLocalize("OK") + otherButtonTitles:nil + ] autorelease]; + + [alert setContext:@"badurl"]; + [alert show]; + + break; + } + if (![href hasSuffix:@"/"]) href_ = [href stringByAppendingString:@"/"]; else @@ -10213,6 +10229,16 @@ int main(int argc, char *argv[]) { Changed_ = true; } + + _H<NSMutableArray> broken([NSMutableArray array]); + for (NSString *key in (id) Sources_) + if ([key rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"# "]].location != NSNotFound) + [broken addObject:key]; + if ([broken count] != 0) { + for (NSString *key in (id) broken) + [Sources_ removeObjectForKey:key]; + Changed_ = true; + } broken = nil; /* }}} */ CydiaWriteSources(); |