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

incorrect implementation of mbstowcs and wcstombs

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 0.4.0
    • RosDlls
    • None
    • 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
          36 kB
          nikita pechenkin
        2. wcstombs.png
          35 kB
          nikita pechenkin
        3. win.png
          22 kB
          nikita pechenkin

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: