summaryrefslogtreecommitdiff
path: root/sql-common
diff options
context:
space:
mode:
authorramil/ram@mysql.com/myoffice.izhnet.ru <>2006-10-04 16:00:44 +0500
committerramil/ram@mysql.com/myoffice.izhnet.ru <>2006-10-04 16:00:44 +0500
commitce433e9e44c7870885d72b567e1c33f7a933f3cb (patch)
treed9947744f488898a87ea87cc648a9282c9feee2b /sql-common
parent397f0df9ad2df62698d4c1824c965c4b884b990c (diff)
downloadmariadb-git-ce433e9e44c7870885d72b567e1c33f7a933f3cb.tar.gz
Fix for bug #21789: DATETIME with 0000-00-00 11:22:33 should be invalid, but is accepted
Reject '0000-00-00 01:01:01' dates.
Diffstat (limited to 'sql-common')
-rw-r--r--sql-common/my_time.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index 3c46a944ba9..e98831ecace 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -350,7 +350,10 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
l_time->year > 9999 || l_time->month > 12 ||
l_time->day > 31 || l_time->hour > 23 ||
l_time->minute > 59 || l_time->second > 59 ||
- (!(flags & TIME_FUZZY_DATE) && (l_time->month == 0 || l_time->day == 0)))
+ (!(flags & TIME_FUZZY_DATE) &&
+ (l_time->month == 0 || l_time->day == 0)) ||
+ (l_time->year == 0 && l_time->month == 0 && l_time->day == 0 &&
+ (l_time->hour != 0 || l_time->minute != 0 || l_time->second != 0)))
{
/* Only give warning for a zero date if there is some garbage after */
if (!not_zero_date) /* If zero date */