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
079912c6
Commit
079912c6
authored
Jan 09, 2006
by
Rein Klazes
Committed by
Alexandre Julliard
Jan 09, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Prevent a crash in GetMenuStringA caused by calling strlenW on
a NULL pointer, with a test.
parent
194eeaab
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
menu.c
dlls/user/menu.c
+1
-0
menu.c
dlls/user/tests/menu.c
+13
-0
No files found.
dlls/user/menu.c
View file @
079912c6
...
...
@@ -3295,6 +3295,7 @@ INT WINAPI GetMenuStringA(
SetLastError
(
ERROR_MENU_ITEM_NOT_FOUND
);
return
0
;
}
if
(
!
item
->
text
)
return
0
;
if
(
!
str
||
!
nMaxSiz
)
return
strlenW
(
item
->
text
);
if
(
!
WideCharToMultiByte
(
CP_ACP
,
0
,
item
->
text
,
-
1
,
str
,
nMaxSiz
,
NULL
,
NULL
))
str
[
nMaxSiz
-
1
]
=
0
;
...
...
dlls/user/tests/menu.c
View file @
079912c6
...
...
@@ -348,6 +348,19 @@ static void test_menu_add_string( void )
ok
(
GetMenuString
(
hmenu
,
0
,
strback
,
99
,
MF_BYPOSITION
),
"GetMenuString on ownerdraw entry failed
\n
"
);
ok
(
!
strcmp
(
strback
,
"string2"
),
"Menu text from Ansi version incorrect
\n
"
);
/* crashes with wine 0.9.5 */
memset
(
&
info
,
0x00
,
sizeof
(
info
));
info
.
cbSize
=
sizeof
(
MENUITEMINFO
);
info
.
fMask
=
MIIM_FTYPE
|
MIIM_STRING
;
/* Set OwnerDraw + typeData */
info
.
fType
=
MFT_OWNERDRAW
;
rc
=
InsertMenuItem
(
hmenu
,
0
,
TRUE
,
&
info
);
ok
(
rc
,
"InsertMenuItem failed
\n
"
);
ok
(
!
GetMenuString
(
hmenu
,
0
,
NULL
,
0
,
MF_BYPOSITION
),
"GetMenuString on ownerdraw entry succeeded.
\n
"
);
ok
(
!
GetMenuStringW
(
hmenu
,
0
,
NULL
,
0
,
MF_BYPOSITION
),
"GetMenuStringW on ownerdraw entry succeeded.
\n
"
);
DestroyMenu
(
hmenu
);
}
...
...
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