System crash when printing log using vfprintf, request from Qualys tool
Hi All,
I am facing issue when am trying to print the message with special characters from the incoming post request of Qualys tool.
I have written small program based on the request.
#include<stdio.h>
#include<stdarg.h>
#include<string.h>
void writeformat(FILE*,char*, ...);
int main()
{
FILE *fp;
fp=fopen("file2.txt","w");
//writeformat(fp,"\222<\b qU\b\222<\b\006");
//writeformat(fp,"T!PV\020");
//writeformat(fp,"\024\031Z\020");
//writeformat(fp,"\\\227V\020");
//writeformat(fp,"\024\031Z\020");
//writeformat(fp,"$pV\020");
writeformat(fp,"TkV\020");
fclose(fp);
return(0);
}
void writeformat(FILE *stream,char *format, ...)
{
va_list args;
va_start(args,format);
vfprintf(stream,format,args);
va_end(args);
}
when i try to execute the commented lines are , the file2 has the following output:
q
T!PV
Z
\V
Z
$pV
TkV
These requests are all making crash in our product. I dont know how to check these in the incoming request and avoid it.
Is there any special functions to check and avoid it.....
Please help me to solve the issue. It is being tricky to handle it.
I must use vfprintf only to print the logs.
The requests are all from Qualys tool only.
Thanks,
G.Ananda Babu.
|