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

incorrect implementation of mbstowcs and wcstombs

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Fix Version/s: 0.4.0
    • Component/s: RosDlls
    • Labels:
      None
    • Environment:

      VirtualBox, ReactOS (r69520)

      Description

      First parameter in wcstombs() and mbstowcs() can be NULL, in this case functions returns the number of characters that would result from conversion.

      char rosStr[BUFFER_SIZE] = "Reactos";
      cnt = mbstowcs(NULL,rosStr,BUFFER_SIZE);
      ...
      wchar_t rosStr[BUFFER_SIZE] = L"Reactos";
      cnt = wcstombs(NULL,rosStr,BUFFER_SIZE);

      Example available here:
      https://github.com/pechenkin/mailslotBug/blob/master/conversionBug.c

        Attachments

        1. mbstowcs.png
          mbstowcs.png
          36 kB
        2. wcstombs.png
          wcstombs.png
          35 kB
        3. win.png
          win.png
          22 kB

          Activity

            People

            • Assignee:
              Heis Spiter Pierre Schweitzer
              Reporter:
              pechenkin nikita pechenkin
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: