From 1c45a0df4a64e3e32edd2a2327e5ed5d30a92562 Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Sun, 26 Oct 2014 10:54:28 -0400 Subject: [PATCH] Don't crash if attempting to import with an invalid password type. --- MasterPassword/ObjC/MPAppDelegate_Store.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MasterPassword/ObjC/MPAppDelegate_Store.m b/MasterPassword/ObjC/MPAppDelegate_Store.m index 1d89941e..65c1aa5c 100644 --- a/MasterPassword/ObjC/MPAppDelegate_Store.m +++ b/MasterPassword/ObjC/MPAppDelegate_Store.m @@ -723,6 +723,10 @@ PearlAssociatedObjectProperty( NSNumber*, StoreCorrupted, storeCorrupted ); // Create new site. NSString *typeEntityName = [MPAlgorithmForVersion( version ) classNameOfType:type]; + if (!typeEntityName) { + err( @"Invalid site type in import file: %@ has type %lu", siteName, (long)type ); + return MPImportResultInternalError; + } MPSiteEntity *site = [NSEntityDescription insertNewObjectForEntityForName:typeEntityName inManagedObjectContext:context]; site.name = siteName; site.loginName = loginName;