diff --git a/MasterPassword/C/mpw-util.c b/MasterPassword/C/mpw-util.c index 49236a39..bf70d2c6 100644 --- a/MasterPassword/C/mpw-util.c +++ b/MasterPassword/C/mpw-util.c @@ -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; diff --git a/MasterPassword/ObjC/iOS/MPPasswordCell.m b/MasterPassword/ObjC/iOS/MPPasswordCell.m index 7261aa89..8dec4dc3 100644 --- a/MasterPassword/ObjC/iOS/MPPasswordCell.m +++ b/MasterPassword/ObjC/iOS/MPPasswordCell.m @@ -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; diff --git a/MasterPassword/ObjC/iOS/MasterPassword-Prefix.pch b/MasterPassword/ObjC/iOS/MasterPassword-Prefix.pch index db91deb3..f2273a8f 100644 --- a/MasterPassword/ObjC/iOS/MasterPassword-Prefix.pch +++ b/MasterPassword/ObjC/iOS/MasterPassword-Prefix.pch @@ -101,7 +101,6 @@ CFStringCreateWithCString( NULL, basename( (char *)__FILE__ ), kCFStringEncodingUTF8 ), __LINE__, \ CFStringCreateWithCString( NULL, __FUNCTION__, kCFStringEncodingUTF8 ), 5, \ CFStringCreateWithCString( NULL, _msg, kCFStringEncodingUTF8 ) ); \ - abort(); \ } while (0) #endif