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
40c783fc
Commit
40c783fc
authored
Sep 30, 2011
by
Nikolay Sivov
Committed by
Alexandre Julliard
Oct 03, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/monthcal: After notification safely free buffer allocated on heap.
parent
5f946531
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
14 deletions
+38
-14
monthcal.c
dlls/comctl32/monthcal.c
+15
-14
monthcal.c
dlls/comctl32/tests/monthcal.c
+23
-0
No files found.
dlls/comctl32/monthcal.c
View file @
40c783fc
...
...
@@ -1884,24 +1884,25 @@ MONTHCAL_HitTest(const MONTHCAL_INFO *infoPtr, MCHITTESTINFO *lpht)
/* MCN_GETDAYSTATE notification helper */
static
void
MONTHCAL_NotifyDayState
(
MONTHCAL_INFO
*
infoPtr
)
{
if
(
infoPtr
->
dwStyle
&
MCS_DAYSTATE
)
{
NMDAYSTATE
nmds
;
MONTHDAYSTATE
*
state
;
NMDAYSTATE
nmds
;
nmds
.
nmhdr
.
hwndFrom
=
infoPtr
->
hwndSelf
;
nmds
.
nmhdr
.
idFrom
=
GetWindowLongPtrW
(
infoPtr
->
hwndSelf
,
GWLP_ID
);
nmds
.
nmhdr
.
code
=
MCN_GETDAYSTATE
;
nmds
.
cDayState
=
MONTHCAL_GetMonthRange
(
infoPtr
,
GMR_DAYSTATE
,
0
);
nmds
.
prgDayState
=
Alloc
(
nmds
.
cDayState
*
sizeof
(
MONTHDAYSTATE
));
if
(
!
(
infoPtr
->
dwStyle
&
MCS_DAYSTATE
))
return
;
MONTHCAL_GetMinDate
(
infoPtr
,
&
nmds
.
stStart
);
nmds
.
stStart
.
wDay
=
1
;
nmds
.
nmhdr
.
hwndFrom
=
infoPtr
->
hwndSelf
;
nmds
.
nmhdr
.
idFrom
=
GetWindowLongPtrW
(
infoPtr
->
hwndSelf
,
GWLP_ID
);
nmds
.
nmhdr
.
code
=
MCN_GETDAYSTATE
;
nmds
.
cDayState
=
MONTHCAL_GetMonthRange
(
infoPtr
,
GMR_DAYSTATE
,
0
);
nmds
.
prgDayState
=
state
=
Alloc
(
nmds
.
cDayState
*
sizeof
(
MONTHDAYSTATE
));
SendMessageW
(
infoPtr
->
hwndNotify
,
WM_NOTIFY
,
nmds
.
nmhdr
.
idFrom
,
(
LPARAM
)
&
nmds
);
memcpy
(
infoPtr
->
monthdayState
,
nmds
.
prgDayState
,
MONTHCAL_GetMonthRange
(
infoPtr
,
GMR_DAYSTATE
,
0
)
*
sizeof
(
MONTHDAYSTATE
));
MONTHCAL_GetMinDate
(
infoPtr
,
&
nmds
.
stStart
);
nmds
.
stStart
.
wDay
=
1
;
Free
(
nmds
.
prgDayState
);
}
SendMessageW
(
infoPtr
->
hwndNotify
,
WM_NOTIFY
,
nmds
.
nmhdr
.
idFrom
,
(
LPARAM
)
&
nmds
);
memcpy
(
infoPtr
->
monthdayState
,
nmds
.
prgDayState
,
MONTHCAL_GetMonthRange
(
infoPtr
,
GMR_DAYSTATE
,
0
)
*
sizeof
(
MONTHDAYSTATE
));
Free
(
state
);
}
/* no valid range check performed */
...
...
dlls/comctl32/tests/monthcal.c
View file @
40c783fc
...
...
@@ -466,6 +466,29 @@ static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LP
add_message
(
sequences
,
PARENT_SEQ_INDEX
,
&
msg
);
}
if
(
message
==
WM_NOTIFY
)
{
NMHDR
*
hdr
=
(
NMHDR
*
)
lParam
;
switch
(
hdr
->
code
)
{
case
MCN_GETDAYSTATE
:
{
NMDAYSTATE
*
nmstate
=
(
NMDAYSTATE
*
)
lParam
;
MONTHDAYSTATE
months
[
14
]
=
{
0
};
ok
(
nmstate
->
cDayState
>
0
,
"got %d
\n
"
,
nmstate
->
cDayState
);
ok
(
nmstate
->
cDayState
<=
14
,
"got %d
\n
"
,
nmstate
->
cDayState
);
ok
(
nmstate
->
prgDayState
!=
NULL
,
"got %p
\n
"
,
nmstate
->
prgDayState
);
nmstate
->
prgDayState
=
months
;
return
TRUE
;
}
default:
break
;
}
}
defwndproc_counter
++
;
ret
=
DefWindowProcA
(
hwnd
,
message
,
wParam
,
lParam
);
defwndproc_counter
--
;
...
...
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