Menu

#41 fatal error - if not default config file

open
nobody
None
5
2008-09-23
2008-09-23
Anonymous
No

the program errors out fatally. It does not have the buffer and strcpy tries to copy to a very small buffer and that's the cause.

Here is the file (code below) that will fix it.

Add:
char gz_CfgFileNameBuffer[1024];
after:
char *gz_FixmeComment = "/* */";

Add:
gz_CfgFileName = gz_CfgFileNameBuffer;
strcpy(gz_CfgFileName, "GC.cfg");

after:
void Options(int argc, char *argv[])
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
int i, j, num;
unsigned char res;
char *ptest, *p;
char asz_Temp[_MAX_PATH];
char asz_Path[_MAX_PATH];
FILE *h;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

Discussion

  • Nobody/Anonymous

    fixed buffer issue

     
  • H. Smith

    H. Smith - 2008-10-03

    Worse yet, sometimes the program with limp along and run with a bogus option table (next set of variables declared.

    This is a very ugly bug and has cost be a couple of hours to track down.

    Ugh.

     
  • H. Smith

    H. Smith - 2008-10-03

    You also need to expand the other two arrays declared next to this variable.

    Any attempt to copy to those arrays results in the same corrupt memory at run-time.

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.