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
6bc8e9a1
Commit
6bc8e9a1
authored
Mar 26, 2008
by
Christopher Berner
Committed by
Alexandre Julliard
Mar 27, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setupapi: Fix buffer size in SetupDiGetDeviceInterfaceDetailW.
parent
1bdd2ab6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletion
+6
-1
devinst.c
dlls/setupapi/devinst.c
+1
-1
devinst.c
dlls/setupapi/tests/devinst.c
+5
-0
No files found.
dlls/setupapi/devinst.c
View file @
6bc8e9a1
...
@@ -2971,7 +2971,7 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(
...
@@ -2971,7 +2971,7 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(
}
}
info
=
(
struct
InterfaceInfo
*
)
DeviceInterfaceData
->
Reserved
;
info
=
(
struct
InterfaceInfo
*
)
DeviceInterfaceData
->
Reserved
;
if
(
info
->
symbolicLink
)
if
(
info
->
symbolicLink
)
bytesNeeded
+=
lstrlenW
(
info
->
symbolicLink
);
bytesNeeded
+=
sizeof
(
WCHAR
)
*
lstrlenW
(
info
->
symbolicLink
);
if
(
DeviceInterfaceDetailDataSize
>=
bytesNeeded
)
if
(
DeviceInterfaceDetailDataSize
>=
bytesNeeded
)
{
{
if
(
info
->
symbolicLink
)
if
(
info
->
symbolicLink
)
...
...
dlls/setupapi/tests/devinst.c
View file @
6bc8e9a1
...
@@ -627,6 +627,7 @@ static void testGetDeviceInterfaceDetail(void)
...
@@ -627,6 +627,7 @@ static void testGetDeviceInterfaceDetail(void)
LPBYTE
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
LPBYTE
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
SP_DEVICE_INTERFACE_DETAIL_DATA_A
*
detail
=
SP_DEVICE_INTERFACE_DETAIL_DATA_A
*
detail
=
(
SP_DEVICE_INTERFACE_DETAIL_DATA_A
*
)
buf
;
(
SP_DEVICE_INTERFACE_DETAIL_DATA_A
*
)
buf
;
DWORD
expectedsize
=
offsetof
(
SP_DEVICE_INTERFACE_DETAIL_DATA_W
,
DevicePath
)
+
sizeof
(
WCHAR
)
*
(
1
+
strlen
(
path
));
detail
->
cbSize
=
0
;
detail
->
cbSize
=
0
;
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
...
@@ -656,6 +657,10 @@ static void testGetDeviceInterfaceDetail(void)
...
@@ -656,6 +657,10 @@ static void testGetDeviceInterfaceDetail(void)
GetLastError
());
GetLastError
());
ok
(
!
lstrcmpiA
(
path
,
detail
->
DevicePath
),
"Unexpected path %s
\n
"
,
ok
(
!
lstrcmpiA
(
path
,
detail
->
DevicePath
),
"Unexpected path %s
\n
"
,
detail
->
DevicePath
);
detail
->
DevicePath
);
/* Check SetupDiGetDeviceInterfaceDetailW */
ret
=
SetupDiGetDeviceInterfaceDetailW
(
set
,
&
interfaceData
,
NULL
,
0
,
&
size
,
NULL
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"Expected ERROR_INSUFFICIENT_BUFFER, got error code: %d
\n
"
,
GetLastError
());
ok
(
expectedsize
==
size
,
"SetupDiGetDeviceInterfaceDetailW returned wrong reqsize: expected %d, got %d
\n
"
,
expectedsize
,
size
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
}
}
pSetupDiDestroyDeviceInfoList
(
set
);
pSetupDiDestroyDeviceInfoList
(
set
);
...
...
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