Changeset 1078 for trunk/dll/filldir.c


Ignore:
Timestamp:
Jul 19, 2008, 6:08:02 AM (17 years ago)
Author:
Steven Levine
Message:

More Fortify infrastructure enhancements
Rework Fortify_SetOwner
Add Fortify_BecomeOwner
Avoid more spurious leak reports

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/filldir.c

    r1077 r1078  
    6363#include "errutil.h"                    // Dos_Error...
    6464#include "strutil.h"                    // GetPString
     65#include "misc.h"                       // GetTidForWindow
     66#include "fortify.h"                    // 06 May 08 SHL
    6567#include "fm3dll.h"
    66 
    67 #include "fortify.h"                    // 06 May 08 SHL
    6868
    6969static PSZ pszSrcFile = __FILE__;
     
    262262      c2++;
    263263    pci->pszFileName = xmalloc(c + c2, pszSrcFile, __LINE__);
     264#   ifdef FORTIFY
     265    {
     266      unsigned tid = GetTidForWindow(hwndCnr);
     267      // char buf[256];
     268      if (tid == 1)
     269        Fortify_ChangeScope(pci->pszFileName, -1);
     270      else
     271        Fortify_SetOwner(pci->pszFileName, 1);
     272      // sprintf(buf, "Owner forced to %u", GetTidForWindow(hwndCnr));
     273      // Fortify_LabelPointer(pci->pszFmtFileSize, buf);
     274    }
     275#   endif
    264276    memcpy(pci->pszFileName, pszDirectory, c + 1);
    265277    p = pci->pszFileName + c - 1;
     
    353365          value = pfea->szName + pfea->cbName + 1;
    354366          value[pfea->cbValue] = 0;
    355           if (*(USHORT *) value == EAT_ASCII)
     367          if (*(USHORT *) value == EAT_ASCII) {
    356368            pci->pszLongName = xstrdup(value + (sizeof(USHORT) * 2), pszSrcFile, __LINE__);
     369#           ifdef FORTIFY
     370            {
     371              unsigned tid = GetTidForWindow(hwndCnr);
     372              // char buf[256];
     373              if (tid == 1)
     374                Fortify_ChangeScope(pci->pszLongName, -1);
     375              else
     376                Fortify_SetOwner(pci->pszLongName, 1);
     377              // sprintf(buf, "Owner forced to %u", GetTidForWindow(hwndCnr));
     378              // Fortify_LabelPointer(pci->pszFmtFileSize, buf);
     379            }
     380#           endif
     381          }
    357382        }
    358383        free(pfealist);
     
    428453  //comma format the file size for large file support
    429454  {
    430   CHAR szBuf[30];
     455    CHAR szBuf[30];
    431456    CommaFmtULL(szBuf, sizeof(szBuf), pffb->cbFile, ' ');
    432457    pci->pszFmtFileSize = xstrdup(szBuf, pszSrcFile, __LINE__);
     458#   ifdef FORTIFY
     459    {
     460      unsigned tid = GetTidForWindow(hwndCnr);
     461      // char buf[256];
     462      if (tid == 1)
     463        Fortify_ChangeScope(pci->pszFmtFileSize, -1);
     464      else
     465        Fortify_SetOwner(pci->pszFmtFileSize, 1);
     466      // sprintf(buf, "Owner forced to %u", GetTidForWindow(hwndCnr));
     467      // Fortify_LabelPointer(pci->pszFmtFileSize, buf);
     468    }
     469#   endif
    433470  }
    434471
Note: See TracChangeset for help on using the changeset viewer.