Changeset 918 for trunk/dll/assoc.c


Ignore:
Timestamp:
Jan 12, 2008, 9:16:37 PM (18 years ago)
Author:
Gregg Young
Message:

Fix CheckApp_QuoteAddExe to return a pointer on the stack instead of a string. Use MAXCOMLINESTRG for command line length.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/assoc.c

    r911 r918  
    4141{
    4242  CHAR mask[CCHMAXPATH];
    43   CHAR cl[1001];
     43  CHAR cl[MAXCOMLINESTRG];
    4444  CHAR sig[CCHMAXPATH];
    4545  LONG offset;
     
    631631      {
    632632        ASSOC temp;
    633         CHAR dummy[34], *psz[1002];
    634 
    635         replace = FALSE;
     633        CHAR dummy[34];
     634        PSZ psz;
     635        replace = FALSE;
     636
    636637        {
    637638          x = (SHORT) WinSendDlgItemMsg(hwnd,
     
    643644                                          LM_SELECTITEM,
    644645                                          MPFROMSHORT(0), MPFROMSHORT(TRUE));
    645         }
     646        }
     647        psz = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__);
    646648        memset(&temp, 0, sizeof(ASSOC));
    647649        WinQueryDlgItemText(hwnd, ASS_MASK, sizeof(temp.mask), temp.mask);
    648650        WinQueryDlgItemText(hwnd, ASS_CL, sizeof(temp.cl), temp.cl);
    649         *psz = CheckApp_QuoteAddExe(temp.cl);
    650         memcpy(temp.cl, *psz, strlen(*psz) + 1);
     651        CheckApp_QuoteAddExe(psz, temp.cl);
     652        memcpy(temp.cl, psz, strlen(psz) + 1);
    651653        WinQueryDlgItemText(hwnd, ASS_SIG, sizeof(temp.sig), temp.sig);
    652654        rstrip(temp.sig);
     
    727729      {
    728730        ASSOC temp;
    729         CHAR dummy[34], *psz[1002];
    730 
     731        CHAR dummy[34];
     732        PSZ psz;
    731733        replace = FALSE;
    732734
     735        psz = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__);
    733736        memset(&temp, 0, sizeof(ASSOC));
    734737        WinQueryDlgItemText(hwnd, ASS_MASK, sizeof(temp.mask), temp.mask);
    735738        WinQueryDlgItemText(hwnd, ASS_CL, sizeof(temp.cl), temp.cl);
    736         *psz = CheckApp_QuoteAddExe(temp.cl);
    737         memcpy(temp.cl, *psz, strlen(*psz) + 1);
     739        CheckApp_QuoteAddExe(psz, temp.cl);
     740        memcpy(temp.cl, psz, strlen(psz) + 1);
    738741        WinQueryDlgItemText(hwnd, ASS_SIG, sizeof(temp.sig), temp.sig);
    739742        rstrip(temp.sig);
     
    836839      {
    837840        ASSOC temp;
    838         CHAR dummy[34], *psz[1002];
    839 
     841        CHAR dummy[34];
     842        PSZ psz;
    840843        replace = TRUE;
    841844
     
    843846                                      ASS_LISTBOX,
    844847                                      LM_QUERYSELECTION,
    845                                       MPFROMSHORT(LIT_CURSOR), MPVOID);
     848                                      MPFROMSHORT(LIT_CURSOR), MPVOID);
     849        psz = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__);
    846850        memset(&temp, 0, sizeof(ASSOC));
    847851        WinQueryDlgItemText(hwnd, ASS_MASK, sizeof(temp.mask), temp.mask);
    848852        WinQueryDlgItemText(hwnd, ASS_CL, sizeof(temp.cl), temp.cl);
    849         *psz = CheckApp_QuoteAddExe(temp.cl);
    850         memcpy(temp.cl, *psz, strlen(*psz) + 1);
     853        CheckApp_QuoteAddExe(psz, temp.cl);
     854        memcpy(temp.cl, psz, strlen(psz) + 1);
    851855        WinQueryDlgItemText(hwnd, ASS_SIG, sizeof(temp.sig), temp.sig);
    852856        rstrip(temp.sig);
Note: See TracChangeset for help on using the changeset viewer.