libc/winsup
Corinna Vinschen c0d7d3e1a2 cygwin wcsxfrm: byte swap result ourselves
Workaround a bug (or undocumented behaviour) in LCMapStringW:

It's documented(*) that the cchDest parameter is a byte count with
LCMAP_SORTKEY, but a character count otherwise.  But the docs don't
state what happens if you combine LCMAP_SORTKEY with LCMAP_BYTEREV.

Tests indicate that LCMAP_SORTKEY treats cchDest as byte count, but
then LCMAP_BYTEREV treats it as char count in the same call.  So the
latter swaps twice as much bytes in the destination buffer than the
byte count it returns, which potentially results in writing past the
end of the given output buffer.

Solution: Don't specify LCMAP_BYTEREV in the LCMapStringW(LCMAP_SORTKEY)
call, rather byte swap afterwards.

(*) https://msdn.microsoft.com/en-us/library/windows/desktop/dd318702(v=vs.85).aspx

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-06-06 18:27:47 +02:00
..
CVSChangeLogs.old winsup: Move all old CVS Changelogs into CVSChangeLogs.old dir 2016-03-19 13:59:52 +01:00
cygserver cygserver: Speed up non-debug scenario 2017-03-24 17:55:36 +01:00
cygwin cygwin wcsxfrm: byte swap result ourselves 2017-06-06 18:27:47 +02:00
doc cygwin doc: Add postinstall/preremove scripts to install Start Menu entries 2017-04-22 14:02:33 +02:00
lsaauth Switching the Cygwin DLL to LGPLv3+, dropping commercial buyout option 2016-06-23 10:09:17 +02:00
testsuite Switching the Cygwin DLL to LGPLv3+, dropping commercial buyout option 2016-06-23 10:09:17 +02:00
utils strace: Fix "over-optimization" flaw in strace. 2017-04-19 20:17:04 +02:00
CONTRIBUTORS cygwin CONTRIBUTORS: Add Daniel Santos 2017-04-25 14:26:36 +02:00
COPYING * COPYING: Replace with the GPLv3 definition. 2011-04-19 16:52:51 +00:00
COPYING.LIB Switching the Cygwin DLL to LGPLv3+, dropping commercial buyout option 2016-06-23 10:09:17 +02:00
CYGWIN_LICENSE Clarify source file license in CYGWIN_LICENSE 2016-06-23 21:52:12 +02:00
Makefile.common Switching the Cygwin DLL to LGPLv3+, dropping commercial buyout option 2016-06-23 10:09:17 +02:00
Makefile.in Switching the Cygwin DLL to LGPLv3+, dropping commercial buyout option 2016-06-23 10:09:17 +02:00
README Fix typo and wrong URL in winsup/README 2016-05-24 10:25:18 +02:00
acinclude.m4 ChangeLog: 2012-11-23 13:22:47 +00:00
aclocal.m4 winsup/ChangeLog: 2013-11-07 00:19:52 +00:00
autogen.sh ChangeLog: 2012-11-23 13:22:47 +00:00
c++wrap ChangeLog: 2012-11-23 13:22:47 +00:00
ccwrap ccwrap: fix build with non-english locale set (v2) 2016-02-29 14:44:23 +01:00
config.guess ChangeLog: 2012-11-23 13:22:47 +00:00
config.sub ChangeLog: 2012-11-23 13:22:47 +00:00
configure Rename without-mingw-progs to with-cross-bootstrap 2016-04-04 16:39:41 +02:00
configure.ac Switching the Cygwin DLL to LGPLv3+, dropping commercial buyout option 2016-06-23 10:09:17 +02:00
configure.cygwin winsup/ChangeLog: 2013-11-07 00:19:52 +00:00
install-sh ChangeLog: 2012-11-23 13:22:47 +00:00

README

THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESSED OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

Cygwin documentation is available on the net at https://cygwin.com
You might especially be interested in

https://cygwin.com/faq/faq.html#faq.programming.building-cygwin