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
9ec6e33e
Commit
9ec6e33e
authored
Nov 15, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Nov 16, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iphlpapi: Don't allocate gobs of memory if interface table is empty.
parent
7e584b43
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
ifenum.c
dlls/iphlpapi/ifenum.c
+4
-2
iphlpapi_main.c
dlls/iphlpapi/iphlpapi_main.c
+12
-7
No files found.
dlls/iphlpapi/ifenum.c
View file @
9ec6e33e
...
...
@@ -205,11 +205,13 @@ InterfaceIndexTable *getInterfaceIndexTable(void)
if
(
indexes
)
{
struct
if_nameindex
*
p
;
DWORD
size
=
sizeof
(
InterfaceIndexTable
);
for
(
p
=
indexes
,
numInterfaces
=
0
;
p
&&
p
->
if_name
;
p
++
)
numInterfaces
++
;
ret
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
InterfaceIndexTable
)
+
(
numInterfaces
-
1
)
*
sizeof
(
DWORD
));
if
(
numInterfaces
>
1
)
size
+=
(
numInterfaces
-
1
)
*
sizeof
(
DWORD
);
ret
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
size
);
if
(
ret
)
{
for
(
p
=
indexes
;
p
&&
p
->
if_name
;
p
++
)
ret
->
indexes
[
ret
->
numIndexes
++
]
=
p
->
if_index
;
...
...
dlls/iphlpapi/iphlpapi_main.c
View file @
9ec6e33e
...
...
@@ -1015,8 +1015,10 @@ DWORD WINAPI GetIfTable(PMIB_IFTABLE pIfTable, PULONG pdwSize, BOOL bOrder)
ret
=
ERROR_INVALID_PARAMETER
;
else
{
DWORD
numInterfaces
=
getNumInterfaces
();
ULONG
size
=
sizeof
(
MIB_IFTABLE
)
+
(
numInterfaces
-
1
)
*
sizeof
(
MIB_IFROW
)
;
ULONG
size
=
sizeof
(
MIB_IFTABLE
);
if
(
numInterfaces
>
1
)
size
+=
(
numInterfaces
-
1
)
*
sizeof
(
MIB_IFROW
);
if
(
!
pIfTable
||
*
pdwSize
<
size
)
{
*
pdwSize
=
size
;
ret
=
ERROR_INSUFFICIENT_BUFFER
;
...
...
@@ -1025,8 +1027,9 @@ DWORD WINAPI GetIfTable(PMIB_IFTABLE pIfTable, PULONG pdwSize, BOOL bOrder)
InterfaceIndexTable
*
table
=
getInterfaceIndexTable
();
if
(
table
)
{
size
=
sizeof
(
MIB_IFTABLE
)
+
(
table
->
numIndexes
-
1
)
*
sizeof
(
MIB_IFROW
);
size
=
sizeof
(
MIB_IFTABLE
);
if
(
table
->
numIndexes
>
1
)
size
+=
(
table
->
numIndexes
-
1
)
*
sizeof
(
MIB_IFROW
);
if
(
*
pdwSize
<
size
)
{
*
pdwSize
=
size
;
ret
=
ERROR_INSUFFICIENT_BUFFER
;
...
...
@@ -1082,9 +1085,10 @@ DWORD WINAPI GetInterfaceInfo(PIP_INTERFACE_INFO pIfTable, PULONG dwOutBufLen)
ret
=
ERROR_INVALID_PARAMETER
;
else
{
DWORD
numInterfaces
=
getNumInterfaces
();
ULONG
size
=
sizeof
(
IP_INTERFACE_INFO
)
+
(
numInterfaces
-
1
)
*
sizeof
(
IP_ADAPTER_INDEX_MAP
);
ULONG
size
=
sizeof
(
IP_INTERFACE_INFO
);
if
(
numInterfaces
>
1
)
size
+=
(
numInterfaces
-
1
)
*
sizeof
(
IP_ADAPTER_INDEX_MAP
);
if
(
!
pIfTable
||
*
dwOutBufLen
<
size
)
{
*
dwOutBufLen
=
size
;
ret
=
ERROR_INSUFFICIENT_BUFFER
;
...
...
@@ -1093,8 +1097,9 @@ DWORD WINAPI GetInterfaceInfo(PIP_INTERFACE_INFO pIfTable, PULONG dwOutBufLen)
InterfaceIndexTable
*
table
=
getInterfaceIndexTable
();
if
(
table
)
{
size
=
sizeof
(
IP_INTERFACE_INFO
)
+
(
table
->
numIndexes
-
1
)
*
sizeof
(
IP_ADAPTER_INDEX_MAP
);
size
=
sizeof
(
IP_INTERFACE_INFO
);
if
(
table
->
numIndexes
>
1
)
size
+=
(
table
->
numIndexes
-
1
)
*
sizeof
(
IP_ADAPTER_INDEX_MAP
);
if
(
*
dwOutBufLen
<
size
)
{
*
dwOutBufLen
=
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