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

Alexandre Julliard julliard at winehq.org
Wed Nov 7 06:18:37 CST 2007


"Dan Kegel" <dank at kegel.com> writes:

> 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.

That function is really supposed to print n chars, not n-1.  The
terminating null probably needs to be included in the length.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list