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
61a02935
Commit
61a02935
authored
Dec 10, 2012
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Dec 10, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iphlpapi: Simplify size calculation of structs with var length array.
parent
034b8d5c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
11 deletions
+3
-11
ifenum.c
dlls/iphlpapi/ifenum.c
+2
-8
iphlpapi_main.c
dlls/iphlpapi/iphlpapi_main.c
+1
-3
No files found.
dlls/iphlpapi/ifenum.c
View file @
61a02935
...
...
@@ -211,13 +211,10 @@ InterfaceIndexTable *getInterfaceIndexTable(void)
if
(
indexes
)
{
struct
if_nameindex
*
p
;
DWORD
size
=
sizeof
(
InterfaceIndexTable
);
for
(
p
=
indexes
,
numInterfaces
=
0
;
p
&&
p
->
if_name
;
p
++
)
numInterfaces
++
;
if
(
numInterfaces
>
1
)
size
+=
(
numInterfaces
-
1
)
*
sizeof
(
DWORD
);
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
FIELD_OFFSET
(
InterfaceIndexTable
,
indexes
[
numInterfaces
]));
if
(
ret
)
{
ret
->
numIndexes
=
0
;
for
(
p
=
indexes
;
p
&&
p
->
if_name
;
p
++
)
...
...
@@ -241,14 +238,11 @@ InterfaceIndexTable *getNonLoopbackInterfaceIndexTable(void)
if
(
indexes
)
{
struct
if_nameindex
*
p
;
DWORD
size
=
sizeof
(
InterfaceIndexTable
);
for
(
p
=
indexes
,
numInterfaces
=
0
;
p
&&
p
->
if_name
;
p
++
)
if
(
!
isLoopbackInterface
(
fd
,
p
->
if_name
))
numInterfaces
++
;
if
(
numInterfaces
>
1
)
size
+=
(
numInterfaces
-
1
)
*
sizeof
(
DWORD
);
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
FIELD_OFFSET
(
InterfaceIndexTable
,
indexes
[
numInterfaces
]));
if
(
ret
)
{
ret
->
numIndexes
=
0
;
for
(
p
=
indexes
;
p
&&
p
->
if_name
;
p
++
)
...
...
dlls/iphlpapi/iphlpapi_main.c
View file @
61a02935
...
...
@@ -1505,10 +1505,8 @@ DWORD WINAPI GetIpAddrTable(PMIB_IPADDRTABLE pIpAddrTable, PULONG pdwSize, BOOL
ret
=
getIPAddrTable
(
&
table
,
GetProcessHeap
(),
0
);
if
(
ret
==
NO_ERROR
)
{
ULONG
size
=
sizeof
(
MIB_IPADDRTABLE
);
ULONG
size
=
FIELD_OFFSET
(
MIB_IPADDRTABLE
,
table
[
table
->
dwNumEntries
]
);
if
(
table
->
dwNumEntries
>
1
)
size
+=
(
table
->
dwNumEntries
-
1
)
*
sizeof
(
MIB_IPADDRROW
);
if
(
!
pIpAddrTable
||
*
pdwSize
<
size
)
{
*
pdwSize
=
size
;
ret
=
ERROR_INSUFFICIENT_BUFFER
;
...
...
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