[PATCH] msado15: Account for terminating null in ReadText() (Coverity).
Alexandre Julliard
julliard at winehq.org
Fri Jan 3 14:56:11 CST 2020
Nikolay Sivov <nsivov at codeweavers.com> writes:
> @@ -424,7 +424,7 @@ static HRESULT WINAPI stream_ReadText( _Stream *iface, LONG len, BSTR *ret )
> if (len == adReadAll) len = (stream->size - stream->pos) / sizeof(WCHAR);
> else len = min( len, stream->size - stream->pos / sizeof(WCHAR) );
>
> - if (!(str = SysAllocStringLen( NULL, len ))) return E_OUTOFMEMORY;
> + if (!(str = SysAllocStringLen( NULL, len + 1 ))) return E_OUTOFMEMORY;
> memcpy( str, stream->buf + stream->pos, len * sizeof(WCHAR) );
> str[len] = 0;
SysAllocStringLen() already adds the final null.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list