[PATCH v3] oledb32: Correct length calculation in DataConvert for DBTYPE_STR

Huw Davies huw at codeweavers.com
Wed Mar 1 05:43:46 CST 2017


On Tue, Feb 28, 2017 at 11:17:29PM +0000, Alistair Leslie-Hughes wrote:
> --- a/dlls/oledb32/convert.c
> +++ b/dlls/oledb32/convert.c
> @@ -816,23 +816,23 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
>      case DBTYPE_STR:
>      {
>          BSTR b;
> -        DBLENGTH bstr_len;
> +        DBLENGTH length;
>          INT bytes_to_copy;
> -        hr = IDataConvert_DataConvert(iface, src_type, DBTYPE_BSTR, src_len, &bstr_len,
> +        hr = IDataConvert_DataConvert(iface, src_type, DBTYPE_BSTR, src_len, &length,
>                                        src, &b, sizeof(BSTR), src_status, dst_status,
>                                        precision, scale, flags);
>          if(hr != S_OK) return hr;
> -        bstr_len = SysStringLen(b);
> -        *dst_len = bstr_len * sizeof(char); /* Doesn't include size for '\0' */
> +        *dst_len =  SysStringLen(b); /* Doesn't include size for '\0' */

You've gone back to confusing the length of a BSTR with the length of
the char * str.  We seem to be going round in circles here, so I've
just sent in the correct fix.  Please take a look at it to figure
out where you were going wrong.

Huw.



More information about the wine-devel mailing list