[PATCH 3/3] comctl32: Better day of the month input checking in datetime.
Lei Zhang
thestig at google.com
Tue Nov 25 17:09:47 CST 2008
This prevents users from typing in invalid day of the month like 61.
-------------- next part --------------
From c99ad63e181a8e824c96e85ed30c8b55c217d3d4 Mon Sep 17 00:00:00 2001
From: Lei Zhang <thestig at google.com>
Date: Tue, 25 Nov 2008 14:59:29 -0800
Subject: [PATCH 3/3] comctl32: Better day of the month input checking in datetime.
---
dlls/comctl32/datetime.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/comctl32/datetime.c b/dlls/comctl32/datetime.c
index de31fa0..2c56f19 100644
--- a/dlls/comctl32/datetime.c
+++ b/dlls/comctl32/datetime.c
@@ -955,6 +955,7 @@ DATETIME_Char (DATETIME_INFO *infoPtr, WPARAM vkCode, LPARAM keyData)
if (vkCode >= '0' && vkCode <= '9') {
int num = vkCode-'0';
+ int newDays;
/* this is a somewhat simplified version of what Windows does */
SYSTEMTIME *date = &infoPtr->date;
@@ -986,11 +987,11 @@ DATETIME_Char (DATETIME_INFO *infoPtr, WPARAM vkCode, LPARAM keyData)
break;
case ONEDIGITDAY:
case TWODIGITDAY:
- /* probably better checking here would help */
- if ((date->wDay%10) >= 3 && num > 1)
+ newDays = (date->wDay%10)*10+num;;
+ if (newDays > MONTHCAL_MonthLength(date->wMonth, date->wYear))
date->wDay = num;
else
- date->wDay = (date->wDay%10)*10+num;
+ date->wDay = newDays;
date->wDayOfWeek = DATETIME_CalculateDayOfWeek(
date->wDay,date->wMonth,date->wYear);
DATETIME_SendDateTimeChangeNotify (infoPtr);
--
1.5.4.5
More information about the wine-patches
mailing list