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
e67deeb8
Commit
e67deeb8
authored
Nov 02, 2012
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Nov 02, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
localspl: Avoid using sizeof on structs with variable length array.
parent
d1f2b8a8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
8 deletions
+4
-8
localmon.c
dlls/localspl/localmon.c
+4
-8
No files found.
dlls/localspl/localmon.c
View file @
e67deeb8
...
...
@@ -513,7 +513,6 @@ cleanup:
static
BOOL
WINAPI
localmon_OpenPortW
(
LPWSTR
pName
,
PHANDLE
phPort
)
{
port_t
*
port
;
DWORD
len
;
DWORD
type
;
TRACE
(
"%s, %p)
\n
"
,
debugstr_w
(
pName
),
phPort
);
...
...
@@ -525,12 +524,11 @@ static BOOL WINAPI localmon_OpenPortW(LPWSTR pName, PHANDLE phPort)
type
=
get_type_from_local_name
(
pName
);
if
(
!
type
)
return
FALSE
;
len
=
(
lstrlenW
(
pName
)
+
1
)
*
sizeof
(
WCHAR
);
port
=
heap_alloc
(
sizeof
(
port_t
)
+
len
);
port
=
heap_alloc
(
FIELD_OFFSET
(
port_t
,
nameW
[
lstrlenW
(
pName
)
+
1
]));
if
(
!
port
)
return
FALSE
;
port
->
type
=
type
;
memcpy
(
port
->
nameW
,
pName
,
len
);
lstrcpyW
(
port
->
nameW
,
pName
);
*
phPort
=
port
;
EnterCriticalSection
(
&
port_handles_cs
);
...
...
@@ -734,16 +732,14 @@ static DWORD WINAPI localmon_XcvDataPort(HANDLE hXcv, LPCWSTR pszDataName, PBYTE
*/
static
BOOL
WINAPI
localmon_XcvOpenPort
(
LPCWSTR
pName
,
ACCESS_MASK
GrantedAccess
,
PHANDLE
phXcv
)
{
DWORD
len
;
xcv_t
*
xcv
;
TRACE
(
"%s, 0x%x, %p)
\n
"
,
debugstr_w
(
pName
),
GrantedAccess
,
phXcv
);
/* No checks for any field is done in Windows */
len
=
(
lstrlenW
(
pName
)
+
1
)
*
sizeof
(
WCHAR
);
xcv
=
heap_alloc
(
sizeof
(
xcv_t
)
+
len
);
xcv
=
heap_alloc
(
FIELD_OFFSET
(
xcv_t
,
nameW
[
lstrlenW
(
pName
)
+
1
]));
if
(
xcv
)
{
xcv
->
GrantedAccess
=
GrantedAccess
;
memcpy
(
xcv
->
nameW
,
pName
,
len
);
lstrcpyW
(
xcv
->
nameW
,
pName
);
*
phXcv
=
xcv
;
EnterCriticalSection
(
&
xcv_handles_cs
);
list_add_tail
(
&
xcv_handles
,
&
xcv
->
entry
);
...
...
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