Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
aedd6e95
Commit
aedd6e95
authored
Mar 01, 2017
by
Huw Davies
Committed by
Alexandre Julliard
Mar 01, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oledb32: Fix conversion of strings with embedded '\0' to DBTYPE_STR | DBTYPE_BYREF.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
853de70b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
2 deletions
+34
-2
convert.c
dlls/oledb32/convert.c
+2
-2
convert.c
dlls/oledb32/tests/convert.c
+32
-0
No files found.
dlls/oledb32/convert.c
View file @
aedd6e95
...
...
@@ -876,13 +876,13 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface,
precision
,
scale
,
flags
);
if
(
hr
!=
S_OK
)
return
hr
;
length
=
WideCharToMultiByte
(
CP_ACP
,
0
,
b
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
length
=
WideCharToMultiByte
(
CP_ACP
,
0
,
b
,
SysStringLen
(
b
)
+
1
,
NULL
,
0
,
NULL
,
NULL
);
*
dst_len
=
length
-
1
;
/* Doesn't include size for '\0' */
*
dst_status
=
DBSTATUS_S_OK
;
*
d
=
CoTaskMemAlloc
(
length
);
if
(
*
d
)
WideCharToMultiByte
(
CP_ACP
,
0
,
b
,
-
1
,
*
d
,
length
,
NULL
,
NULL
);
WideCharToMultiByte
(
CP_ACP
,
0
,
b
,
SysStringLen
(
b
)
+
1
,
*
d
,
length
,
NULL
,
NULL
);
else
hr
=
E_OUTOFMEMORY
;
SysFreeString
(
b
);
...
...
dlls/oledb32/tests/convert.c
View file @
aedd6e95
...
...
@@ -2155,6 +2155,7 @@ static void test_converttobyrefstr(void)
DBSTATUS
dst_status
;
DBLENGTH
dst_len
;
static
const
WCHAR
ten
[]
=
{
'1'
,
'0'
,
0
};
static
const
char
withnull
[]
=
"test
\0
ed"
;
BSTR
b
;
VARIANT
v
;
...
...
@@ -2232,6 +2233,37 @@ static void test_converttobyrefstr(void)
ok
(
!
lstrcmpA
(
"10"
,
dst
),
"got %s
\n
"
,
dst
);
CoTaskMemFree
(
dst
);
memcpy
(
src
,
withnull
,
sizeof
(
withnull
));
dst_len
=
0x1234
;
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_STR
,
DBTYPE_STR
|
DBTYPE_BYREF
,
sizeof
(
withnull
),
&
dst_len
,
src
,
&
dst
,
sizeof
(
dst
),
0
,
&
dst_status
,
0
,
0
,
0
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_S_OK
,
"got %08x
\n
"
,
dst_status
);
ok
(
dst_len
==
8
,
"got %ld
\n
"
,
dst_len
);
ok
(
!
memcmp
(
withnull
,
dst
,
8
),
"got %s
\n
"
,
dst
);
ok
(
dst
[
8
]
==
0
,
"got %02x
\n
"
,
dst
[
8
]);
CoTaskMemFree
(
dst
);
memcpy
(
src
,
withnull
,
sizeof
(
withnull
));
dst_len
=
0x1234
;
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_STR
,
DBTYPE_STR
|
DBTYPE_BYREF
,
7
,
&
dst_len
,
src
,
&
dst
,
sizeof
(
dst
),
0
,
&
dst_status
,
0
,
0
,
0
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_S_OK
,
"got %08x
\n
"
,
dst_status
);
ok
(
dst_len
==
7
,
"got %ld
\n
"
,
dst_len
);
ok
(
!
memcmp
(
withnull
,
dst
,
7
),
"got %s
\n
"
,
dst
);
ok
(
dst
[
7
]
==
0
,
"got %02x
\n
"
,
dst
[
7
]);
CoTaskMemFree
(
dst
);
memcpy
(
src
,
withnull
,
sizeof
(
withnull
));
dst_len
=
0x1234
;
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_STR
,
DBTYPE_STR
|
DBTYPE_BYREF
,
6
,
&
dst_len
,
src
,
&
dst
,
sizeof
(
dst
),
0
,
&
dst_status
,
0
,
0
,
0
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
dst_status
==
DBSTATUS_S_OK
,
"got %08x
\n
"
,
dst_status
);
ok
(
dst_len
==
6
,
"got %ld
\n
"
,
dst_len
);
ok
(
!
memcmp
(
withnull
,
dst
,
6
),
"got %s
\n
"
,
dst
);
ok
(
dst
[
6
]
==
0
,
"got %02x
\n
"
,
dst
[
6
]);
CoTaskMemFree
(
dst
);
dst_len
=
44
;
V_VT
(
&
v
)
=
VT_NULL
;
hr
=
IDataConvert_DataConvert
(
convert
,
DBTYPE_VARIANT
,
DBTYPE_STR
|
DBTYPE_BYREF
,
0
,
&
dst_len
,
&
v
,
dst
,
sizeof
(
dst
),
0
,
&
dst_status
,
0
,
0
,
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment