Potential non-terminated string in getEncodingInternal() on Windows

XMLWordPrintable

    • b23
    • windows
    • Not verified

      The getEncodingInternal() function in

      src/java.base/windows/native/libjava/java_props_md.c

      calls the Windows GetLocaleInfo() function. Upon success, a null-terminated string is written to the buffer 'ret'. If GetLocaleInfo() fails, the default case of the switch(codepage) will write "Cp" to the first two chars of 'ret',
      but the rest of the buffer remains uninitialized and un-terminated.

      Though we've not reproduced GetLocaleInfo() failing, this code should be updated to avoid a potential unterminated/uninitialized string.

            Assignee:
            Brent Christian
            Reporter:
            Brent Christian
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: