Fix to Coverity defect 76134

This commit is contained in:
Markus Makela
2014-11-13 09:02:56 +02:00
parent aaa9bfd5c2
commit fb9d792859

View File

@ -57,9 +57,7 @@ int main(int argc, char** argv)
{ {
fgets(readbuff,4092,infile); fgets(readbuff,4092,infile);
psize = strlen(readbuff); psize = strlen(readbuff);
if(psize > 4092){ if(psize < 4092){
continue;
}
qbuff = gwbuf_alloc(psize + 7); qbuff = gwbuf_alloc(psize + 7);
*(qbuff->sbuf->data + 0) = (unsigned char)psize; *(qbuff->sbuf->data + 0) = (unsigned char)psize;
*(qbuff->sbuf->data + 1) = (unsigned char)(psize>>8); *(qbuff->sbuf->data + 1) = (unsigned char)(psize>>8);
@ -71,7 +69,7 @@ int main(int argc, char** argv)
fprintf(outfile,"%s\n",tok); fprintf(outfile,"%s\n",tok);
free(tok); free(tok);
gwbuf_free(qbuff); gwbuf_free(qbuff);
}
} }
fclose(infile); fclose(infile);
fclose(outfile); fclose(outfile);