Commit fe5471e7 authored by Kanit Therdsteerasukdi's avatar Kanit Therdsteerasukdi Committed by Alexandre Julliard

comctl32: datetime: Reject out of range dates in DTM_SETSYSTEMTIME.

parent d9445ce7
......@@ -160,6 +160,17 @@ DATETIME_SetSystemTime (DATETIME_INFO *infoPtr, DWORD flag, SYSTEMTIME *lprgSysT
lprgSysTimeArray->wYear, lprgSysTimeArray->wMonth, lprgSysTimeArray->wDay,
lprgSysTimeArray->wHour, lprgSysTimeArray->wMinute, lprgSysTimeArray->wSecond);
if (lprgSysTimeArray->wYear < 1601 || lprgSysTimeArray->wYear > 30827 ||
lprgSysTimeArray->wMonth < 1 || lprgSysTimeArray->wMonth > 12 ||
lprgSysTimeArray->wDayOfWeek > 6 ||
lprgSysTimeArray->wDay < 1 || lprgSysTimeArray->wDay > 31 ||
lprgSysTimeArray->wHour > 23 ||
lprgSysTimeArray->wMinute > 59 ||
lprgSysTimeArray->wSecond > 59 ||
lprgSysTimeArray->wMilliseconds > 999
)
return 0;
if (flag == GDT_VALID) {
infoPtr->dateValid = TRUE;
MONTHCAL_CopyTime (lprgSysTimeArray, &infoPtr->date);
......
......@@ -509,10 +509,8 @@ static void test_dtm_set_and_get_system_time(HWND hWndDateTime)
/* set st to invalid value */
fill_systime_struct(&st, 0, 0, 7, 0, 24, 60, 60, 1000);
todo_wine {
r = SendMessage(hWndDateTime, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st);
expect_unsuccess(0, r);
}
r = SendMessage(hWndDateTime, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st);
expect_unsuccess(0, r);
ok_sequence(sequences, DATETIME_SEQ_INDEX, test_dtm_set_and_get_system_time_seq, "test_dtm_set_and_get_system_time", FALSE);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment