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
bc8d04d6
Commit
bc8d04d6
authored
Jul 09, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mountmgr: Fix handling of buffer overflows in IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
113e9811
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
31 deletions
+11
-31
mountmgr.c
dlls/mountmgr.sys/mountmgr.c
+11
-31
No files found.
dlls/mountmgr.sys/mountmgr.c
View file @
bc8d04d6
...
...
@@ -328,6 +328,7 @@ static NTSTATUS query_unix_drive( void *buff, SIZE_T insize,
}
size
=
sizeof
(
*
output
);
if
(
label
)
size
+=
(
strlenW
(
label
)
+
1
)
*
sizeof
(
WCHAR
);
if
(
device
)
size
+=
strlen
(
device
)
+
1
;
if
(
mount_point
)
size
+=
strlen
(
mount_point
)
+
1
;
...
...
@@ -342,54 +343,33 @@ static NTSTATUS query_unix_drive( void *buff, SIZE_T insize,
output
->
device_offset
=
0
;
output
->
label_offset
=
0
;
if
(
size
>
outsize
)
{
iosb
->
Information
=
0
;
if
(
size
>=
FIELD_OFFSET
(
struct
mountmgr_unix_drive
,
size
)
+
sizeof
(
output
->
size
))
{
output
->
size
=
size
;
iosb
->
Information
=
FIELD_OFFSET
(
struct
mountmgr_unix_drive
,
size
)
+
sizeof
(
output
->
size
);
}
if
(
size
>=
FIELD_OFFSET
(
struct
mountmgr_unix_drive
,
type
)
+
sizeof
(
output
->
type
))
{
output
->
type
=
type
;
iosb
->
Information
=
FIELD_OFFSET
(
struct
mountmgr_unix_drive
,
type
)
+
sizeof
(
output
->
type
);
}
status
=
STATUS_BUFFER_OVERFLOW
;
goto
done
;
}
ptr
=
(
char
*
)(
output
+
1
);
if
(
mount_point
)
if
(
label
&&
ptr
+
(
strlenW
(
label
)
+
1
)
*
sizeof
(
WCHAR
)
-
(
char
*
)
output
<=
outsize
)
{
output
->
label_offset
=
ptr
-
(
char
*
)
output
;
strcpyW
(
(
WCHAR
*
)
ptr
,
label
);
ptr
+=
(
strlenW
(
label
)
+
1
)
*
sizeof
(
WCHAR
);
}
if
(
mount_point
&&
ptr
+
strlen
(
mount_point
)
+
1
-
(
char
*
)
output
<=
outsize
)
{
output
->
mount_point_offset
=
ptr
-
(
char
*
)
output
;
strcpy
(
ptr
,
mount_point
);
ptr
+=
strlen
(
ptr
)
+
1
;
}
else
output
->
mount_point_offset
=
0
;
if
(
device
)
if
(
device
&&
ptr
+
strlen
(
device
)
+
1
-
(
char
*
)
output
<=
outsize
)
{
output
->
device_offset
=
ptr
-
(
char
*
)
output
;
strcpy
(
ptr
,
device
);
ptr
+=
strlen
(
ptr
)
+
1
;
}
else
output
->
device_offset
=
0
;
if
(
label
)
{
output
->
label_offset
=
ptr
-
(
char
*
)
output
;
strcpyW
(
(
WCHAR
*
)
ptr
,
label
);
ptr
+=
(
strlenW
(
label
)
+
1
)
*
sizeof
(
WCHAR
);
}
else
output
->
label_offset
=
0
;
TRACE
(
"returning %c: dev %s mount %s type %u
\n
"
,
letter
,
debugstr_a
(
device
),
debugstr_a
(
mount_point
),
type
);
iosb
->
Information
=
ptr
-
(
char
*
)
output
;
done:
if
(
size
>
outsize
)
status
=
STATUS_BUFFER_OVERFLOW
;
RtlFreeHeap
(
GetProcessHeap
(),
0
,
device
);
RtlFreeHeap
(
GetProcessHeap
(),
0
,
mount_point
);
RtlFreeHeap
(
GetProcessHeap
(),
0
,
label
);
...
...
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