blockNum = 0;\r
while(!feof(f)){\r
memset(buf, 0, sizeof(buf));\r
- fgets(buf, sizeof(buf), f);\r
+ if (fgets(buf, sizeof(buf), f) == NULL) {\r
+ PrintAndLog("File reading error.");\r
+ return 2;\r
+ }\r
\r
if (strlen(buf) < 32){\r
if (feof(f)) break;\r