[PATCH 1/5] msxml3: When writing to stream \0 terminate output.

Nikolay Sivov nsivov at codeweavers.com
Tue Apr 27 03:27:16 CDT 2021


On 4/27/21 10:48 AM, Dmitry Timoshkov wrote:
> This fixes heap corruption when running the domdoc tests.
>
> Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
> ---
>  dlls/msxml3/domdoc.c       | 12 +++++++++++-
>  dlls/msxml3/tests/domdoc.c |  3 ---
>  2 files changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c
> index cf4f0433218..cb34632c203 100644
> --- a/dlls/msxml3/domdoc.c
> +++ b/dlls/msxml3/domdoc.c
> @@ -2524,8 +2524,18 @@ static int XMLCALL domdoc_stream_save_writecallback(void *ctx, const char *buffe
>  
>  static int XMLCALL domdoc_stream_save_closecallback(void *ctx)
>  {
> +    ULONG written;
> +    HRESULT hr;
> +
> +    hr = IStream_Write((IStream*)ctx, "\0", 1, &written);
> +    if (hr != S_OK)
> +    {
> +        WARN("stream write error: 0x%08x\n", hr);
> +        hr = -1;
> +    }
> +
>      IStream_Release((IStream*)ctx);
> -    return 0;
> +    return hr;
>  }
This will need a test on its own, if it really does that. Callback
should return 0 or -1, as documented.



More information about the wine-devel mailing list