Update ikeys.c

FIX: 'hf iclass'  - sneaky fread bug.   It should return same number of bytes as read if ok.   Thanks to @bettse who found it.
This commit is contained in:
Iceman 2018-01-01 14:20:19 +01:00 committed by GitHub
commit 45c406fb47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -739,18 +739,16 @@ int readKeyFile(uint8_t key[8])
FILE *f;
int retval = 1;
f = fopen("iclass_key.bin", "rb");
if (f)
{
if(fread(key, sizeof(uint8_t), 8, f) == 1)
{
retval = 0;
}
fclose(f);
if (!f)
return retval;
if (fread(key, sizeof(uint8_t), 8, f) == 8) {
retval = 0;
}
fclose(f);
return retval;
}
int doKeyTests(uint8_t debuglevel)
{
debug_print = debuglevel;