Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
07f38445
Commit
07f38445
authored
Sep 01, 2000
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid buffer overflows in builtin dll loading (with the help of Dmitry
Timoshkov).
parent
60cf612b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
7 deletions
+15
-7
builtin.c
if1632/builtin.c
+6
-3
builtin32.c
relay32/builtin32.c
+9
-4
No files found.
if1632/builtin.c
View file @
07f38445
...
@@ -136,16 +136,19 @@ static HMODULE16 BUILTIN_DoLoadModule16( const BUILTIN16_DESCRIPTOR *descr )
...
@@ -136,16 +136,19 @@ static HMODULE16 BUILTIN_DoLoadModule16( const BUILTIN16_DESCRIPTOR *descr )
*/
*/
HMODULE16
BUILTIN_LoadModule
(
LPCSTR
name
)
HMODULE16
BUILTIN_LoadModule
(
LPCSTR
name
)
{
{
char
dllname
[
16
],
*
p
;
char
dllname
[
20
],
*
p
;
void
*
handle
;
void
*
handle
;
int
i
;
int
i
;
/* Fix the name in case we have a full path and extension */
/* Fix the name in case we have a full path and extension */
if
((
p
=
strrchr
(
name
,
'\\'
)))
name
=
p
+
1
;
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
,
'.'
);
p
=
strrchr
(
dllname
,
'.'
);
if
(
!
p
)
strcat
(
dllname
,
".dll"
);
if
(
!
p
)
strcat
(
dllname
,
".dll"
);
for
(
i
=
0
;
i
<
nb_dlls
;
i
++
)
for
(
i
=
0
;
i
<
nb_dlls
;
i
++
)
...
...
relay32/builtin32.c
View file @
07f38445
...
@@ -264,15 +264,19 @@ WINE_MODREF *BUILTIN32_LoadLibraryExA(LPCSTR path, DWORD flags)
...
@@ -264,15 +264,19 @@ WINE_MODREF *BUILTIN32_LoadLibraryExA(LPCSTR path, DWORD flags)
{
{
HMODULE
module
;
HMODULE
module
;
WINE_MODREF
*
wm
;
WINE_MODREF
*
wm
;
char
dllname
[
MAX_PATH
],
*
p
;
char
dllname
[
20
],
*
p
;
LPCSTR
name
;
void
*
handle
;
void
*
handle
;
int
i
;
int
i
;
/* Fix the name in case we have a full path and extension */
/* Fix the name in case we have a full path and extension */
if
((
p
=
strrchr
(
path
,
'\\'
)))
p
++
;
name
=
path
;
else
p
=
(
char
*
)
path
;
if
((
p
=
strrchr
(
name
,
'\\'
)))
name
=
p
+
1
;
lstrcpynA
(
dllname
,
p
,
sizeof
(
dllname
)
);
if
((
p
=
strrchr
(
name
,
'/'
)))
name
=
p
+
1
;
if
(
strlen
(
name
)
>=
sizeof
(
dllname
)
-
4
)
goto
error
;
strcpy
(
dllname
,
name
);
p
=
strrchr
(
dllname
,
'.'
);
p
=
strrchr
(
dllname
,
'.'
);
if
(
!
p
)
strcat
(
dllname
,
".dll"
);
if
(
!
p
)
strcat
(
dllname
,
".dll"
);
...
@@ -288,6 +292,7 @@ WINE_MODREF *BUILTIN32_LoadLibraryExA(LPCSTR path, DWORD flags)
...
@@ -288,6 +292,7 @@ WINE_MODREF *BUILTIN32_LoadLibraryExA(LPCSTR path, DWORD flags)
BUILTIN32_dlclose
(
handle
);
BUILTIN32_dlclose
(
handle
);
}
}
error:
SetLastError
(
ERROR_FILE_NOT_FOUND
);
SetLastError
(
ERROR_FILE_NOT_FOUND
);
return
NULL
;
return
NULL
;
...
...
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