c/3918: Access violation when using GCC to compile CGI scripts with fread and fgetc functions

mlcarey59@email.msn.com mlcarey59@email.msn.com
Thu Aug 2 16:36:00 GMT 2001


>Number:         3918
>Category:       c
>Synopsis:       Access violation when using GCC to compile CGI scripts with fread and fgetc functions
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 02 16:36:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Marcus Carey
>Release:        GCC Version 2.95.3-2
>Organization:
>Environment:
Win 2000 Server
>Description:
Problem accessing GCC compiled programs from IE 5.0 web browser using IIS 5.0 web server.  

The program compiles and works using the windows console. But when accesed from a web browser the program causes a STATUS_ACCESS_VIOLATION. This violation occures if the program calls the fread and fgets functions after opening a file.  

Also the programs compiles and works using the MS VC++ 6.00 compiler.
>How-To-Repeat:
Create a c program that opens a file. Place the program in a cgi-bin and call it from a web browser. 
void main()
{
FILE *filename;
char *filebuffer[BUFFER_SIZE];
filename = fopen("file","r");
fgets(filebuffer,sizeof(filebuffer),filename);
printf("%s",filebuffer);
}
>Fix:
Most of the STATUS_ACCESS_VIOLATIONS I have encounter have to deal with memmory.  However I could not find a solution to fix this problem.
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list