iOS: Get the length from the generator

This fixes reading over the buffer if it is not zero terminated.
Fortunately, this was almost always the case by pure luck.
This commit is contained in:
Jonathan Schleifer 2017-10-21 22:04:45 +02:00
parent 8de675d32c
commit d414924126
No known key found for this signature in database
GPG key ID: 28D65178B37F33E3

View file

@ -200,10 +200,11 @@ clearNSMutableString(NSMutableString *string)
free(passphrase); free(passphrase);
} }
NSMutableString *password = [NSMutableString NSMutableString *password = [[[NSMutableString alloc]
stringWithUTF8String: (char *)generator.output]; initWithBytes: (char *)generator.output
of_explicit_memset(generator.output, 0, length: generator.length
strlen((char *)generator.output)); encoding: NSUTF8StringEncoding] autorelease];
of_explicit_memset(generator.output, 0, generator.length);
dispatch_sync(dispatch_get_main_queue(), ^ { dispatch_sync(dispatch_get_main_queue(), ^ {
activityController.view.hidden = YES; activityController.view.hidden = YES;