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
f1f68312
Commit
f1f68312
authored
Jan 01, 2000
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed potential buffer overflows (spotted by Francois Gouget).
parent
6f715732
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
31 deletions
+34
-31
ddeml.c
misc/ddeml.c
+8
-17
win.c
windows/win.c
+26
-14
No files found.
misc/ddeml.c
View file @
f1f68312
...
@@ -445,16 +445,16 @@ void FindNotifyMonitorCallbacks(DWORD ThisInstance, DWORD DdeEvent )
...
@@ -445,16 +445,16 @@ void FindNotifyMonitorCallbacks(DWORD ThisInstance, DWORD DdeEvent )
*
*
*/
*/
void
DdeReserveAtom
(
DDE_HANDLE_ENTRY
*
reference_inst
,
HSZ
hsz
)
static
void
DdeReserveAtom
(
DDE_HANDLE_ENTRY
*
reference_inst
,
HSZ
hsz
)
{
{
CHAR
SNameBuffer
[
MAX_BUFFER_LEN
];
UINT
rcode
;
if
(
reference_inst
->
Unicode
)
if
(
reference_inst
->
Unicode
)
{
{
rcode
=
GlobalGetAtomNameW
(
hsz
,(
LPWSTR
)
&
SNameBuffer
,
MAX_ATOM_LEN
);
WCHAR
SNameBuffer
[
MAX_BUFFER_LEN
];
GlobalAddAtomW
((
LPWSTR
)
SNameBuffer
);
GlobalGetAtomNameW
(
hsz
,
SNameBuffer
,
MAX_BUFFER_LEN
);
GlobalAddAtomW
(
SNameBuffer
);
}
else
{
}
else
{
rcode
=
GlobalGetAtomNameA
(
hsz
,
SNameBuffer
,
MAX_ATOM_LEN
);
CHAR
SNameBuffer
[
MAX_BUFFER_LEN
];
GlobalGetAtomNameA
(
hsz
,
SNameBuffer
,
MAX_BUFFER_LEN
);
GlobalAddAtomA
(
SNameBuffer
);
GlobalAddAtomA
(
SNameBuffer
);
}
}
}
}
...
@@ -475,18 +475,9 @@ void DdeReserveAtom( DDE_HANDLE_ENTRY * reference_inst,HSZ hsz)
...
@@ -475,18 +475,9 @@ void DdeReserveAtom( DDE_HANDLE_ENTRY * reference_inst,HSZ hsz)
*
*
*/
*/
void
DdeReleaseAtom
(
DDE_HANDLE_ENTRY
*
reference_inst
,
HSZ
hsz
)
static
void
DdeReleaseAtom
(
DDE_HANDLE_ENTRY
*
reference_inst
,
HSZ
hsz
)
{
{
CHAR
SNameBuffer
[
MAX_BUFFER_LEN
];
GlobalDeleteAtom
(
hsz
);
UINT
rcode
;
if
(
reference_inst
->
Unicode
)
{
rcode
=
GlobalGetAtomNameW
(
hsz
,(
LPWSTR
)
&
SNameBuffer
,
MAX_ATOM_LEN
);
GlobalAddAtomW
((
LPWSTR
)
SNameBuffer
);
}
else
{
rcode
=
GlobalGetAtomNameA
(
hsz
,
SNameBuffer
,
MAX_ATOM_LEN
);
GlobalAddAtomA
(
SNameBuffer
);
}
}
}
/******************************************************************************
/******************************************************************************
...
...
windows/win.c
View file @
f1f68312
...
@@ -663,7 +663,6 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
...
@@ -663,7 +663,6 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
HWND16
hwnd
,
hwndLinkAfter
;
HWND16
hwnd
,
hwndLinkAfter
;
POINT
maxSize
,
maxPos
,
minTrack
,
maxTrack
;
POINT
maxSize
,
maxPos
,
minTrack
,
maxTrack
;
LRESULT
(
CALLBACK
*
localSend32
)(
HWND
,
UINT
,
WPARAM
,
LPARAM
);
LRESULT
(
CALLBACK
*
localSend32
)(
HWND
,
UINT
,
WPARAM
,
LPARAM
);
char
buffer
[
256
];
TRACE
(
"%s %s %08lx %08lx %d,%d %dx%d %04x %04x %08x %p
\n
"
,
TRACE
(
"%s %s %08lx %08lx %d,%d %dx%d %04x %04x %08x %p
\n
"
,
unicode
?
debugres_w
((
LPWSTR
)
cs
->
lpszName
)
:
debugres_a
(
cs
->
lpszName
),
unicode
?
debugres_w
((
LPWSTR
)
cs
->
lpszName
)
:
debugres_a
(
cs
->
lpszName
),
...
@@ -689,24 +688,12 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
...
@@ -689,24 +688,12 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
/* Find the window class */
/* Find the window class */
if
(
!
(
classPtr
=
CLASS_FindClassByAtom
(
classAtom
,
win32
?
cs
->
hInstance
:
GetExePtr
(
cs
->
hInstance
)
)))
if
(
!
(
classPtr
=
CLASS_FindClassByAtom
(
classAtom
,
win32
?
cs
->
hInstance
:
GetExePtr
(
cs
->
hInstance
)
)))
{
{
char
buffer
[
256
];
GlobalGetAtomNameA
(
classAtom
,
buffer
,
sizeof
(
buffer
)
);
GlobalGetAtomNameA
(
classAtom
,
buffer
,
sizeof
(
buffer
)
);
WARN
(
"Bad class '%s'
\n
"
,
buffer
);
WARN
(
"Bad class '%s'
\n
"
,
buffer
);
return
0
;
return
0
;
}
}
/* Fix the lpszClass field: from existing programs, it seems ok to call a CreateWindowXXX
* with an atom as the class name, put some programs expect to have a *REAL* string in
* lpszClass when the CREATESTRUCT is sent with WM_CREATE
*/
if
(
!
HIWORD
(
cs
->
lpszClass
)
)
{
if
(
unicode
)
{
GlobalGetAtomNameW
(
classAtom
,
(
LPWSTR
)
buffer
,
sizeof
(
buffer
)
);
}
else
{
GlobalGetAtomNameA
(
classAtom
,
buffer
,
sizeof
(
buffer
)
);
}
cs
->
lpszClass
=
buffer
;
}
/* Fix the coordinates */
/* Fix the coordinates */
if
(
cs
->
x
==
CW_USEDEFAULT
||
cs
->
x
==
CW_USEDEFAULT16
)
if
(
cs
->
x
==
CW_USEDEFAULT
||
cs
->
x
==
CW_USEDEFAULT16
)
...
@@ -1047,6 +1034,7 @@ HWND16 WINAPI CreateWindowEx16( DWORD exStyle, LPCSTR className,
...
@@ -1047,6 +1034,7 @@ HWND16 WINAPI CreateWindowEx16( DWORD exStyle, LPCSTR className,
{
{
ATOM
classAtom
;
ATOM
classAtom
;
CREATESTRUCTA
cs
;
CREATESTRUCTA
cs
;
char
buffer
[
256
];
/* Find the class atom */
/* Find the class atom */
...
@@ -1075,6 +1063,13 @@ HWND16 WINAPI CreateWindowEx16( DWORD exStyle, LPCSTR className,
...
@@ -1075,6 +1063,13 @@ HWND16 WINAPI CreateWindowEx16( DWORD exStyle, LPCSTR className,
cs
.
lpszName
=
windowName
;
cs
.
lpszName
=
windowName
;
cs
.
lpszClass
=
className
;
cs
.
lpszClass
=
className
;
cs
.
dwExStyle
=
exStyle
;
cs
.
dwExStyle
=
exStyle
;
/* make sure lpszClass is a string */
if
(
!
HIWORD
(
cs
.
lpszClass
))
{
GlobalGetAtomNameA
(
classAtom
,
buffer
,
sizeof
(
buffer
)
);
cs
.
lpszClass
=
buffer
;
}
return
WIN_CreateWindowEx
(
&
cs
,
classAtom
,
FALSE
,
FALSE
);
return
WIN_CreateWindowEx
(
&
cs
,
classAtom
,
FALSE
,
FALSE
);
}
}
...
@@ -1090,6 +1085,7 @@ HWND WINAPI CreateWindowExA( DWORD exStyle, LPCSTR className,
...
@@ -1090,6 +1085,7 @@ HWND WINAPI CreateWindowExA( DWORD exStyle, LPCSTR className,
{
{
ATOM
classAtom
;
ATOM
classAtom
;
CREATESTRUCTA
cs
;
CREATESTRUCTA
cs
;
char
buffer
[
256
];
if
(
!
instance
)
if
(
!
instance
)
instance
=
GetModuleHandleA
(
NULL
);
instance
=
GetModuleHandleA
(
NULL
);
...
@@ -1120,6 +1116,13 @@ HWND WINAPI CreateWindowExA( DWORD exStyle, LPCSTR className,
...
@@ -1120,6 +1116,13 @@ HWND WINAPI CreateWindowExA( DWORD exStyle, LPCSTR className,
cs
.
lpszName
=
windowName
;
cs
.
lpszName
=
windowName
;
cs
.
lpszClass
=
className
;
cs
.
lpszClass
=
className
;
cs
.
dwExStyle
=
exStyle
;
cs
.
dwExStyle
=
exStyle
;
/* make sure lpszClass is a string */
if
(
!
HIWORD
(
cs
.
lpszClass
))
{
GlobalGetAtomNameA
(
classAtom
,
buffer
,
sizeof
(
buffer
)
);
cs
.
lpszClass
=
buffer
;
}
return
WIN_CreateWindowEx
(
&
cs
,
classAtom
,
TRUE
,
FALSE
);
return
WIN_CreateWindowEx
(
&
cs
,
classAtom
,
TRUE
,
FALSE
);
}
}
...
@@ -1135,6 +1138,7 @@ HWND WINAPI CreateWindowExW( DWORD exStyle, LPCWSTR className,
...
@@ -1135,6 +1138,7 @@ HWND WINAPI CreateWindowExW( DWORD exStyle, LPCWSTR className,
{
{
ATOM
classAtom
;
ATOM
classAtom
;
CREATESTRUCTW
cs
;
CREATESTRUCTW
cs
;
WCHAR
buffer
[
256
];
if
(
!
instance
)
if
(
!
instance
)
instance
=
GetModuleHandleA
(
NULL
);
instance
=
GetModuleHandleA
(
NULL
);
...
@@ -1171,6 +1175,14 @@ HWND WINAPI CreateWindowExW( DWORD exStyle, LPCWSTR className,
...
@@ -1171,6 +1175,14 @@ HWND WINAPI CreateWindowExW( DWORD exStyle, LPCWSTR className,
cs
.
lpszName
=
windowName
;
cs
.
lpszName
=
windowName
;
cs
.
lpszClass
=
className
;
cs
.
lpszClass
=
className
;
cs
.
dwExStyle
=
exStyle
;
cs
.
dwExStyle
=
exStyle
;
/* make sure lpszClass is a string */
if
(
!
HIWORD
(
cs
.
lpszClass
))
{
GlobalGetAtomNameW
(
classAtom
,
buffer
,
sizeof
(
buffer
)
/
sizeof
(
WCHAR
)
);
cs
.
lpszClass
=
buffer
;
}
/* Note: we rely on the fact that CREATESTRUCT32A and */
/* Note: we rely on the fact that CREATESTRUCT32A and */
/* CREATESTRUCT32W have the same layout. */
/* CREATESTRUCT32W have the same layout. */
return
WIN_CreateWindowEx
(
(
CREATESTRUCTA
*
)
&
cs
,
classAtom
,
TRUE
,
TRUE
);
return
WIN_CreateWindowEx
(
(
CREATESTRUCTA
*
)
&
cs
,
classAtom
,
TRUE
,
TRUE
);
...
...
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