Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Johnny Cai
wine
Commits
07f38445
Commit
07f38445
authored
24 years ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
Avoid buffer overflows in builtin dll loading (with the help of Dmitry
Timoshkov).
parent
60cf612b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
if1632/builtin.c
+6
-3
6 additions, 3 deletions
if1632/builtin.c
relay32/builtin32.c
+9
-4
9 additions, 4 deletions
relay32/builtin32.c
with
15 additions
and
7 deletions
if1632/builtin.c
+
6
−
3
View file @
07f38445
...
...
@@ -136,16 +136,19 @@ static HMODULE16 BUILTIN_DoLoadModule16( const BUILTIN16_DESCRIPTOR *descr )
*/
HMODULE16
BUILTIN_LoadModule
(
LPCSTR
name
)
{
char
dllname
[
16
],
*
p
;
char
dllname
[
20
],
*
p
;
void
*
handle
;
int
i
;
/* Fix the name in case we have a full path and extension */
if
((
p
=
strrchr
(
name
,
'\\'
)))
name
=
p
+
1
;
lstrcpynA
(
dllname
,
name
,
sizeof
(
dllname
)
);
if
((
p
=
strrchr
(
name
,
'/'
)))
name
=
p
+
1
;
if
(
strlen
(
name
)
>=
sizeof
(
dllname
)
-
4
)
return
(
HMODULE16
)
2
;
strcpy
(
dllname
,
name
);
p
=
strrchr
(
dllname
,
'.'
);
if
(
!
p
)
strcat
(
dllname
,
".dll"
);
for
(
i
=
0
;
i
<
nb_dlls
;
i
++
)
...
...
This diff is collapsed.
Click to expand it.
relay32/builtin32.c
+
9
−
4
View file @
07f38445
...
...
@@ -264,15 +264,19 @@ WINE_MODREF *BUILTIN32_LoadLibraryExA(LPCSTR path, DWORD flags)
{
HMODULE
module
;
WINE_MODREF
*
wm
;
char
dllname
[
MAX_PATH
],
*
p
;
char
dllname
[
20
],
*
p
;
LPCSTR
name
;
void
*
handle
;
int
i
;
/* Fix the name in case we have a full path and extension */
if
((
p
=
strrchr
(
path
,
'\\'
)))
p
++
;
else
p
=
(
char
*
)
path
;
lstrcpynA
(
dllname
,
p
,
sizeof
(
dllname
)
);
name
=
path
;
if
((
p
=
strrchr
(
name
,
'\\'
)))
name
=
p
+
1
;
if
((
p
=
strrchr
(
name
,
'/'
)))
name
=
p
+
1
;
if
(
strlen
(
name
)
>=
sizeof
(
dllname
)
-
4
)
goto
error
;
strcpy
(
dllname
,
name
);
p
=
strrchr
(
dllname
,
'.'
);
if
(
!
p
)
strcat
(
dllname
,
".dll"
);
...
...
@@ -288,6 +292,7 @@ WINE_MODREF *BUILTIN32_LoadLibraryExA(LPCSTR path, DWORD flags)
BUILTIN32_dlclose
(
handle
);
}
error:
SetLastError
(
ERROR_FILE_NOT_FOUND
);
return
NULL
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment