Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-14306 (GitHub Actions) clang-cl 10 reports some warnings: review/fix them
  3. CORE-14308

SearchPathW(): "dll\win32\kernel32\client\path.c(1420,23) : warning: comparison 'DWORD' (aka 'unsigned long') > 4294967295 is always false [-Wtautological-constant-compare]"

    XMLWordPrintable

Details

    • Sub-task
    • Resolution: Unresolved
    • Major
    • None
    • RosDlls
    • None

    Description

      SearchPathW()

      Ftr, 1st case is correct: USHORT bytes into int characters into ULONG.

      1361         LengthNeeded = lstrlenW(PathString.Buffer);
      1362         if (LengthNeeded > UNICODE_STRING_MAX_CHARS)
      

      2nd case is warned: ULONG into DWORD.

      1393     Status = RtlDosSearchPath_Ustr(Flags,
      1394                                    &PathString,
      1395                                    &FileNameString,
      1396                                    &ExtensionString,
      1397                                    &CallerBuffer,
      1398                                    NULL,
      1399                                    NULL,
      1400                                    &FilePartSize,
      1401                                    &LengthNeeded);
      ...
      1419             Result = LengthNeeded / sizeof(WCHAR);
      1420             if (Result > 0xFFFFFFFF) BaseSetLastNTError(STATUS_NAME_TOO_LONG);
      

      It feels like 0xFFFFFFFF should be UNICODE_STRING_MAX_CHARS.
      But I am not familiar with RtlDosSearchPath_Ustr() and related functions code, and it/they misses documentation.

      This code was added as is in r54713 by alex_ionescu.

      Fwiw, RtlDosSearchPath_Ustr() expects a PSIZE_T, not a PULONG. Wrt x64...

      Attachments

        Activity

          People

            bug zilla Bug Zilla
            Serge Gautherie Serge Gautherie
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: