]> cvs.zerfleddert.de Git - proxmark3-svn/commitdiff
FIX, Coverity, Argument can't be negative, CID #212324, ftell(f) can be negative...
authoriceman1001 <iceman@iuse.se>
Tue, 12 Jan 2016 21:49:29 +0000 (22:49 +0100)
committericeman1001 <iceman@iuse.se>
Tue, 12 Jan 2016 21:49:29 +0000 (22:49 +0100)
client/cmdhficlass.c

index 86524cd6c51e049f9fef6de36a6d945e9bd8dc71..5f45ab1aeed09d304b1db0d91cc70bf4a54849d2 100644 (file)
@@ -1316,8 +1316,13 @@ int CmdHFiClassReadTagFile(const char *Cmd) {
        long fsize = ftell(f);
        fseek(f, 0, SEEK_SET);
 
-       uint8_t *dump = malloc(fsize);
+       if ( fsize < 0 ) {
+               PrintAndLog("Error, when getting filesize");
+               fclose(f);
+               return 1;
+       }
 
+       uint8_t *dump = malloc(fsize);
 
        size_t bytes_read = fread(dump, 1, fsize, f);
        fclose(f);
Impressum, Datenschutz