Changeset 889 for trunk/dll/systemf.c


Ignore:
Timestamp:
Dec 24, 2007, 3:17:16 AM (18 years ago)
Author:
Gregg Young
Message:

Fix crash in runemf2 quote check code when program sring in capitals

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/systemf.c

    r888 r889  
    636636  BOOL useTermQ = FALSE;
    637637  char szTempdir[CCHMAXPATH];
    638   char szTempPgm[CCHMAXPATH], tempcom[1024], temparg[1024], buf[10] = " &|<>";
     638  char szTempPgm[CCHMAXPATH], tempcom[2048], temparg[2048], buf[10] = " &|<>";
    639639  char *offset, *offsetexe, *offsetcom, *offsetcmd, *offsetbtm, *offsetbat;
    640640  UINT offsetquote;
     
    685685           parguments);
    686686  va_end(parguments);
    687   offsetexe = strstr(pszPgm, ".exe");
    688   offsetcmd = strstr(pszPgm, ".cmd");
    689   offsetcom = strstr(pszPgm, ".com");
    690   offsetbtm = strstr(pszPgm, ".btm");
    691   offsetbat = strstr(pszPgm, ".bat");
     687  offsetexe = strstr(strlwr(pszPgm), ".exe");
     688  offsetcmd = strstr(strlwr(pszPgm), ".cmd");
     689  offsetcom = strstr(strlwr(pszPgm), ".com");
     690  offsetbtm = strstr(strlwr(pszPgm), ".btm");
     691  offsetbat = strstr(strlwr(pszPgm), ".bat");
    692692  if (offsetexe)
    693693    offset = offsetexe;
     
    700700  else if (offsetbat)
    701701    offset = offsetbat;
    702   else
    703     offset = NULL;
     702  else {
     703    Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,GetPString(IDS_NOTDIRECTEXETEXT));
     704    return -1;
     705  }
    704706  offsetquote = strcspn(pszPgm, buf);
    705707  if (pszPgm[0] != '\"' && offsetquote < offset - pszPgm && offsetquote != NULL){
     
    713715    BldQuotedFileName(szTempPgm, tempcom);
    714716    strcat(szTempPgm, temparg);
    715     memcpy(pszPgm, szTempPgm, 1024);
     717    memcpy(pszPgm, szTempPgm, 2048);
    716718    //printf("%s\n %s\n%s %s\n %d %d",
    717719    //       pszPgm, szTempPgm, tempcom, temparg, offset, offsetquote); fflush(stdout);
Note: See TracChangeset for help on using the changeset viewer.