Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-15766

Finding the end of a Unicode string in the PnpRegSzToString() function is done incorrectly.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 0.4.12
    • NTCore
    • None

    Description

      This function is used to determine the length of a string obtained from the registry using the KEY_VALUE_FULL_INFORMATION structure. The DataLength field of this structure specifies the number of BYTES of registry information to write the value identified by the name.
      Since variable "pp" is PWCHAR type, it is necessary to divide RegSzLength into two.

      BOOLEAN
      NTAPI
      PnpRegSzToString(IN PWCHAR RegSzData,
                       IN ULONG RegSzLength,
                       OUT PUSHORT StringLength OPTIONAL)
      {
          PWCHAR p, pp;
       
          /* Find the end */
          pp = RegSzData + (RegSzLength / 2);
          for (p = RegSzData; p < pp; p++) if (!*p) break;
       
          /* Return it */
          if (StringLength) *StringLength = (USHORT)(p - RegSzData) * sizeof(WCHAR);
          return TRUE;
      }
      
      

      Attachments

        Activity

          People

            ThFabba ThFabba
            vgal vgal
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: