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,21 +57,19 @@ 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->sbuf->data + 0) = (unsigned char)psize;
qbuff = gwbuf_alloc(psize + 7); *(qbuff->sbuf->data + 1) = (unsigned char)(psize>>8);
*(qbuff->sbuf->data + 0) = (unsigned char)psize; *(qbuff->sbuf->data + 2) = (unsigned char)(psize>>16);
*(qbuff->sbuf->data + 1) = (unsigned char)(psize>>8); *(qbuff->sbuf->data + 4) = 0x03;
*(qbuff->sbuf->data + 2) = (unsigned char)(psize>>16); memcpy(qbuff->start + 5,readbuff,psize + 1);
*(qbuff->sbuf->data + 4) = 0x03; parse_query(qbuff);
memcpy(qbuff->start + 5,readbuff,psize + 1); tok = skygw_get_canonical(qbuff);
parse_query(qbuff); fprintf(outfile,"%s\n",tok);
tok = skygw_get_canonical(qbuff); free(tok);
fprintf(outfile,"%s\n",tok); gwbuf_free(qbuff);
free(tok); }
gwbuf_free(qbuff);
} }
fclose(infile); fclose(infile);
fclose(outfile); fclose(outfile);