]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
add check to fread call
authormarshmellow42 <marshmellowrf@gmail.com>
Sun, 14 Feb 2016 16:07:16 +0000 (11:07 -0500)
committermarshmellow42 <marshmellowrf@gmail.com>
Sun, 14 Feb 2016 16:07:16 +0000 (11:07 -0500)
client/cmdhficlass.c

index 6c85e1c1100d8299310e2e3806227694f42ec475..59b0ddc3cff115b2e5b4710a514d52d6c0b5d27e 100644 (file)
@@ -1046,7 +1046,11 @@ int CmdHFiClassCloneTag(const char *Cmd) {
        // else we have to create a share memory
        int i;
        fseek(f,startblock*8,SEEK_SET);
-       fread(tag_data,sizeof(iclass_block_t),endblock - startblock + 1,f);
+       if ( fread(tag_data,sizeof(iclass_block_t),endblock - startblock + 1,f) == 0 ) {
+               PrintAndLog("File reading error.");
+               fclose(f);
+               return 2;
+       }
 
        uint8_t MAC[4]={0x00,0x00,0x00,0x00};
        uint8_t div_key[8]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
Impressum, Datenschutz