mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-09-19 10:37:54 +08:00
Retain a limit on both ends, mark where we might return a null instead.
This commit is contained in:
@@ -894,10 +894,9 @@ mdb_date_to_tm(double td, struct tm *t)
|
||||
long yr, q;
|
||||
const int *cal;
|
||||
|
||||
// if you want to limit 1900--2700, do this
|
||||
// but it's not necessary
|
||||
// if (td < 0.0 || td > 1e6) // About 2700 AD
|
||||
// return;
|
||||
// limit to ~1100AD--2700A to protect from overflow
|
||||
if (td < -1e6 || td > 1e6)
|
||||
return;
|
||||
|
||||
yr = 1;
|
||||
day = (long)(td);
|
||||
@@ -947,6 +946,8 @@ mdb_date_to_string(MdbHandle *mdb, const char *fmt, void *buf, int start)
|
||||
|
||||
mdb_date_to_tm(td, &t);
|
||||
|
||||
// check if t is still unchanged, return empty string?
|
||||
|
||||
strftime(text, mdb->bind_size, mdb->date_fmt, &t);
|
||||
|
||||
return text;
|
||||
|
Reference in New Issue
Block a user