]> cvs.zerfleddert.de Git - proxmark3-svn/commitdiff
FIX: Coverity , Argument can't be negative, CID #121323, ftell(f) can be negative...
authoriceman1001 <iceman@iuse.se>
Tue, 12 Jan 2016 21:47:48 +0000 (22:47 +0100)
committericeman1001 <iceman@iuse.se>
Tue, 12 Jan 2016 21:47:48 +0000 (22:47 +0100)
FIX: forgot to close the filehandle :(

client/cmdhficlass.c

index d475073572a7fd1c9c1035fa0e575b7f9314e0d9..86524cd6c51e049f9fef6de36a6d945e9bd8dc71 100644 (file)
@@ -286,10 +286,10 @@ int CmdHFiClassELoad(const char *Cmd) {
 
        if (fsize < 0)  {
                prnlog("Error, when getting filesize");
+               fclose(f);
                return 1;
        }
 
-
        uint8_t *dump = malloc(fsize);
 
        size_t bytes_read = fread(dump, 1, fsize, f);
@@ -1509,6 +1509,12 @@ static int loadKeys(char *filename) {
        long fsize = ftell(f);
        fseek(f, 0, SEEK_SET);
 
+       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);
Impressum, Datenschutz