Some more error handling.
This commit is contained in:
@@ -26,13 +26,12 @@
|
||||
#define MP_N 32768
|
||||
#define MP_r 8
|
||||
#define MP_p 2
|
||||
#define MP_hash PearlHashSHA256
|
||||
|
||||
static const char *mpw_templateForType_v0(MPPasswordType type, uint16_t seedByte) {
|
||||
|
||||
size_t count = 0;
|
||||
const char **templates = mpw_templatesForType( type, &count );
|
||||
char const *template = count? templates[seedByte % count]: NULL;
|
||||
char const *template = templates && count? templates[seedByte % count]: NULL;
|
||||
free( templates );
|
||||
return template;
|
||||
}
|
||||
|
@@ -150,7 +150,7 @@ const char *mpw_templateForType(MPPasswordType type, uint8_t seedByte) {
|
||||
|
||||
size_t count = 0;
|
||||
const char **templates = mpw_templatesForType( type, &count );
|
||||
char const *template = count? templates[seedByte % count]: NULL;
|
||||
char const *template = templates && count? templates[seedByte % count]: NULL;
|
||||
free( templates );
|
||||
return template;
|
||||
}
|
||||
|
Reference in New Issue
Block a user