advpack: Fix buffer sizes for possibly quoted strings (try 2, including testcase)

Michael Karcher wine at
Thu May 29 09:20:42 CDT 2008

Increase buffer size to make quoted strings fit. This fixes the problem
Dan described in which
is caused by quoted 'HKLM' not fitting into prefix. This patch does, on
request, *not* fix the bigger picture issue that made it possible for
this bug to slip for such a long time, which is missing error checking
on SetupGetStringFieldW calls in get_dest_dir. Valid .inf files should,
of course, not exercise the missing error check, so on valid .inf
files, this patch is sufficient for correct behaviour.

In the testcase with quoted 'HKLM', SetupGetStringFieldW fails because
of unsufficient buffer size, which is *ignore* by the current code. As
from the previous destination parsed in the patch the local automatic
variable still contains the unquoted HKLM and by luck does not get
overwritten between invocations of get_dest_dir, the testcase passes
nevertheless except if compiled by gutsy's gcc 4.1 without optimization
which puts the local variable to a stack location that does not survive
between different invocations of get_dest_dir.

The attached change to the testcase "pollutes" the local variable prefix
with HKCU, so the bug is always exposed and not just by bad luck.
 dlls/advpack/advpack.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 9d3637c30014787f6a9337d384992579e34e0de3.diff
Type: text/x-patch
Size: 1276 bytes
Desc: not available
Url : 

More information about the wine-patches mailing list