Ignore:
Timestamp:
Jun 18, 2009, 11:53:26 AM (16 years ago)
Author:
ydario
Message:

Kernel32 updates.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/handlenames.cpp

    r9975 r21302  
    164164                                          BOOL fCaseInsensitive)
    165165{
     166  int               cchSymbolicLink = strlen(pszSymbolicLink);
    166167  PLINEARLISTENTRY pLE = pSymbolicLinks->getFirst();
    167168  while (pLE)
    168169  {
    169170    PHANDLENAME pHandleName = (PHANDLENAME)pLE->pObject;
    170    
    171     int iLen = strlen(pHandleName->pszSymbolicLink);
    172    
     171    int cch = pHandleName->ulSymbolicLinkLength; //strlen(pHandleName->pszSymbolicLink);
     172   
     173    /* pszSymbolicLink must end a path component at cch. */
     174    if (    cch <= cchSymbolicLink
     175        &&  (pszSymbolicLink[cch] == '\\' || pszSymbolicLink[cch] == '\0'))
     176    {
    173177    if (fCaseInsensitive)
    174178    {
    175       // Note: pszSymbolicLink must either terminate at [iLen] or
    176       // have a delimiter.
    177       if ( (pszSymbolicLink[iLen] == '\\') ||
    178            (pszSymbolicLink[iLen] == 0) )
    179         if (strnicmp(pHandleName->pszSymbolicLink, pszSymbolicLink, iLen) == 0)
     179            if (!strnicmp(pHandleName->pszSymbolicLink, pszSymbolicLink, cch))
    180180          return pHandleName;
    181181    }
    182182    else
    183183    {
    184       if ( (pszSymbolicLink[iLen] == '\\') ||
    185            (pszSymbolicLink[iLen] == 0) )
    186         if (strncmp(pHandleName->pszSymbolicLink, pszSymbolicLink, iLen) == 0)
     184            if (!memcmp(pHandleName->pszSymbolicLink, pszSymbolicLink, cch))
    187185          return pHandleName;
    188186    }
    189    
     187    }
    190188   
    191189    // skip to the next entry
Note: See TracChangeset for help on using the changeset viewer.