mirror of
https://github.com/fadden/ciderpress.git
synced 2024-12-21 14:30:02 +00:00
Fix for issue #20
Reject NuDateTime structs with invalid fields. Passing bogus values to the ATL CTime constructor does bad things.
This commit is contained in:
parent
a8c2e4cfd6
commit
8e326f2f62
@ -1,5 +1,5 @@
|
|||||||
End-User License Agreement for CiderPress
|
End-User License Agreement for CiderPress
|
||||||
Copyright (c) 2016, CiderPress project authors
|
Copyright (C) 2017, CiderPress project authors
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
AGREEMENT. After reading this agreement carefully, if you ("Customer") do
|
AGREEMENT. After reading this agreement carefully, if you ("Customer") do
|
||||||
|
@ -835,6 +835,7 @@ NuResult NufxArchive::ContentFunc(NuArchive* pArchive, void* vpRecord)
|
|||||||
pDateTime->extra == 0 &&
|
pDateTime->extra == 0 &&
|
||||||
pDateTime->weekDay == 0)
|
pDateTime->weekDay == 0)
|
||||||
{
|
{
|
||||||
|
// not invalid; just no date set
|
||||||
return kDateNone;
|
return kDateNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -858,8 +859,17 @@ NuResult NufxArchive::ContentFunc(NuArchive* pArchive, void* vpRecord)
|
|||||||
//LOGI(" Ignoring funky year %ld", year);
|
//LOGI(" Ignoring funky year %ld", year);
|
||||||
return kDateInvalid;
|
return kDateInvalid;
|
||||||
}
|
}
|
||||||
if (pDateTime->month > 11)
|
|
||||||
|
// Must range-check values before passing them to CTime constructor, which
|
||||||
|
// now throws a remarkably fatal exception.
|
||||||
|
if (pDateTime->month > 11 || // [0,11]
|
||||||
|
pDateTime->day > 30 || // [0,30]
|
||||||
|
pDateTime->hour > 59 || // [0,59]
|
||||||
|
pDateTime->minute > 59 || // [0,59]
|
||||||
|
pDateTime->second > 59) { // [0,59]
|
||||||
|
|
||||||
return kDateInvalid;
|
return kDateInvalid;
|
||||||
|
}
|
||||||
|
|
||||||
CTime modTime(year,
|
CTime modTime(year,
|
||||||
pDateTime->month+1,
|
pDateTime->month+1,
|
||||||
@ -867,7 +877,8 @@ NuResult NufxArchive::ContentFunc(NuArchive* pArchive, void* vpRecord)
|
|||||||
pDateTime->hour,
|
pDateTime->hour,
|
||||||
pDateTime->minute,
|
pDateTime->minute,
|
||||||
pDateTime->second);
|
pDateTime->second);
|
||||||
return (time_t) modTime.GetTime();
|
time_t result = (time_t)modTime.GetTime();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*static*/ NuResult NufxArchive::ArrayDeleteHandler(NuArchive* pArchive, void* ptr)
|
/*static*/ NuResult NufxArchive::ArrayDeleteHandler(NuArchive* pArchive, void* ptr)
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
2017/09/21 ***** v3.1.0 shipped *****
|
||||||
|
|
||||||
2016/01/11 fadden
|
2016/01/11 fadden
|
||||||
- Fix handling of disk images (broken by previous change).
|
- Fix handling of disk images (broken by previous change).
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user