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, 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) { uint64_t N, uint32_t r, uint32_t p) {
if (!secret || !salt)
return NULL;
uint8_t *key = malloc( keySize ); uint8_t *key = malloc( keySize );
if (!key) if (!key)
return NULL; return NULL;

View File

@ -540,15 +540,13 @@
if (!key) if (!key)
return; return;
NSString *password, *loginName = [site resolveLoginUsingKey:key]; NSString *password = nil, *loginName = [site resolveLoginUsingKey:key];
if (self.transientSite) MPSiteType transientType = [[MPiOSAppDelegate get] activeUserInContext:context].defaultType?: MPSiteTypeGeneratedLong;
password = [MPAlgorithmDefault generatePasswordForSiteNamed:self.transientSite ofType: if (self.transientSite && transientType & MPSiteTypeClassGenerated)
[[MPiOSAppDelegate get] activeUserInContext:context].defaultType?: MPSiteTypeGeneratedLong password = [MPAlgorithmDefault generatePasswordForSiteNamed:self.transientSite ofType:transientType
withCounter:1 usingKey:key]; withCounter:1 usingKey:key];
else if (site) else if (site)
password = [site resolvePasswordUsingKey:key]; password = [site resolvePasswordUsingKey:key];
else
return;
TimeToCrack timeToCrack; TimeToCrack timeToCrack;
NSString *timeToCrackString = nil; NSString *timeToCrackString = nil;

View File

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