RFR: 8244767 - Potential non-terminated string in getEncodingInternal() on Windows

Brent Christian brent.christian at oracle.com
Mon May 11 23:36:09 UTC 2020


Hi,

Please review this small fix in Windows native code:

    Bug: https://bugs.openjdk.java.net/browse/JDK-8244767
Webrev: http://cr.openjdk.java.net/~bchristi/8244767/webrev-00/

As reported on this thread[1], the getEncodingInternal() function has a 
potential unterminated string in the case that the GetLocaleInfo() 
Windows function fails.  In this case, the default switch() case will 
write "Cp" to the beginning of the 'ret' buffer, but the rest of the 
buffer remains uninitialized and unterminated.

The fix is to strcpy() the default codepage into 'ret'.

Thanks to Johannes Kuhn for uncovering this issue and submitting the fix.

An automated build and test run is in progress.

-Brent

1. http://mail.openjdk.java.net/pipermail/core-libs-dev/2020-May/066310.html


More information about the core-libs-dev mailing list