advapi32: fix buffer overrun in tests/registry.c:wine_debugstr_wn(), try 3

Dan Kegel dank at
Sat Nov 3 20:34:21 CDT 2007

Fixes an off-by-one buffer overflow in wine_debugstr_wn()
in which the wchar after the end of the buffer was read.

This is same as try 2, but is slightly clearer and more correct.

Found via Valgrind warning:
 Conditional jump or move depends on uninitialised value(s)
    at 0x45F3219: wine_debugstr_wn (registry.c:151)
    by 0x45F34F5: test_hkey_main_Value_W (registry.c:284)
    by 0x45F7644: func_registry (registry.c:327)
    by 0x460A127: run_test (test.h:387)

Alexandre, if you don't like this 'un, please tell me why.
- Dan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: advapi32-debugstr.patch
Type: text/x-diff
Size: 656 bytes
Desc: not available
Url : 

More information about the wine-patches mailing list