2
0

Fix crash when default type is not a generated type, when password is unset and don't crash for fatals.

This commit is contained in:
Maarten Billemont 2016-07-06 01:16:10 -04:00
parent 28bd162e05
commit 588ebe08cd
3 changed files with 9 additions and 9 deletions

View File

@ -66,6 +66,9 @@ void mpw_freeString(const char *string) {
uint8_t const *mpw_scrypt(const size_t keySize, const char *secret, const uint8_t *salt, const size_t saltSize,
uint64_t N, uint32_t r, uint32_t p) {
if (!secret || !salt)
return NULL;
uint8_t *key = malloc( keySize );
if (!key)
return NULL;

View File

@ -532,23 +532,21 @@
self.passwordField.attributedPlaceholder = stra(
mainSite.type & MPSiteTypeClassStored? strl( @"No password" ):
mainSite.type & MPSiteTypeClassGenerated? strl( @"..." ): @"", @{
NSForegroundColorAttributeName : [UIColor whiteColor]
} );
NSForegroundColorAttributeName : [UIColor whiteColor]
} );
[MPiOSAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *context) {
MPSiteEntity *site = [self siteInContext:context];
MPKey *key = [MPiOSAppDelegate get].key;
if (!key)
return;
NSString *password, *loginName = [site resolveLoginUsingKey:key];
if (self.transientSite)
password = [MPAlgorithmDefault generatePasswordForSiteNamed:self.transientSite ofType:
[[MPiOSAppDelegate get] activeUserInContext:context].defaultType?: MPSiteTypeGeneratedLong
NSString *password = nil, *loginName = [site resolveLoginUsingKey:key];
MPSiteType transientType = [[MPiOSAppDelegate get] activeUserInContext:context].defaultType?: MPSiteTypeGeneratedLong;
if (self.transientSite && transientType & MPSiteTypeClassGenerated)
password = [MPAlgorithmDefault generatePasswordForSiteNamed:self.transientSite ofType:transientType
withCounter:1 usingKey:key];
else if (site)
password = [site resolvePasswordUsingKey:key];
else
return;
TimeToCrack timeToCrack;
NSString *timeToCrackString = nil;

View File

@ -101,7 +101,6 @@
CFStringCreateWithCString( NULL, basename( (char *)__FILE__ ), kCFStringEncodingUTF8 ), __LINE__, \
CFStringCreateWithCString( NULL, __FUNCTION__, kCFStringEncodingUTF8 ), 5, \
CFStringCreateWithCString( NULL, _msg, kCFStringEncodingUTF8 ) ); \
abort(); \
} while (0)
#endif