[USETUP]
authorAleksey Bragin <aleksey@reactos.org>
Fri, 4 Mar 2011 18:18:05 +0000 (18:18 +0000)
committerAleksey Bragin <aleksey@reactos.org>
Fri, 4 Mar 2011 18:18:05 +0000 (18:18 +0000)
commit85f0fb63f37d72783c2c7372452682d371a3b63f
treecdecb015c53dc8c287a167521b054695d832f64d
parent2bf17fadd15f1c24495371df05061d5cbf94aa3d
[USETUP]
- Fix a buffer overflow (overread) when adding a locale key to the registry. The history of this bug is funny:
1. Eric wrote the code, which sets a key of REG_SZ type, as 4 widechars plus terminating zero, but passes 8 as the bytesize of the buffer. It's not fully correct (a terminating zero is absent from the bytesize of the buffer, but MSDN doesn't specify if it should be added or not, and hardcoding "8" is not the best idea too) but not dramatic. That was revision 9596, 7 years ago.
2. Lentin notices something is not right in this code, and decides to "fix" it by multiplying that same hardcoded value by.... guess what? sizeof(PWCHAR)! That is, size of a pointer, which on an x86 would be 4 bytes. Massive out of bounds access obviously happens. That was revision 31642, 3 years ago.
3. Very soon Colin reshuffles and improves the code based on patch #2635, however the problem still goes unnoticed (r31655+).
See issue #5810 for more details.

svn path=/trunk/; revision=50968
reactos/base/setup/usetup/settings.c