4853. [bug] Add REQUIRE's and INSIST's to isc_time_formatISO8601L

and isc_time_formatISO8601Lms. [RT #46916]
This commit is contained in:
Mark Andrews
2018-01-02 10:57:31 +11:00
parent 7770e0b069
commit 0645f8f1ce
3 changed files with 15 additions and 0 deletions

View File

@@ -1,3 +1,6 @@
4853. [bug] Add REQUIRE's and INSIST's to isc_time_formatISO8601L
and isc_time_formatISO8601Lms. [RT #46916]
4852. [bug] Handle strftime() failing in isc_time_formatISO8601ms.
Add REQUIRE's and INSIST's to isc_time_formattimestamp,
isc_time_formathttptimestamp, isc_time_formatISO8601,

View File

@@ -454,6 +454,9 @@ isc_time_formatISO8601L(const isc_time_t *t, char *buf, unsigned int len) {
struct tm tm;
#endif
REQUIRE(t != NULL);
INSIST(t->nanoseconds < NS_PER_S);
REQUIRE(buf != NULL);
REQUIRE(len > 0);
now = (time_t)t->seconds;
@@ -473,6 +476,9 @@ isc_time_formatISO8601Lms(const isc_time_t *t, char *buf, unsigned int len) {
struct tm tm;
#endif
REQUIRE(t != NULL);
INSIST(t->nanoseconds < NS_PER_S);
REQUIRE(buf != NULL);
REQUIRE(len > 0);
now = (time_t)t->seconds;

View File

@@ -343,7 +343,10 @@ isc_time_formatISO8601L(const isc_time_t *t, char *buf, unsigned int len) {
/* strtime() format: "%Y-%m-%dT%H:%M:%S" */
REQUIRE(t != NULL);
REQUIRE(buf != NULL);
REQUIRE(len > 0);
if (FileTimeToSystemTime(&t->absolute, &st)) {
GetDateFormat(LOCALE_USER_DEFAULT, 0, &st, "yyyy-MM-dd",
DateBuf, 50);
@@ -364,7 +367,10 @@ isc_time_formatISO8601Lms(const isc_time_t *t, char *buf, unsigned int len) {
/* strtime() format: "%Y-%m-%dT%H:%M:%S.SSS" */
REQUIRE(t != NULL);
REQUIRE(buf != NULL);
REQUIRE(len > 0);
if (FileTimeToSystemTime(&t->absolute, &st)) {
GetDateFormat(LOCALE_USER_DEFAULT, 0, &st, "yyyy-MM-dd",
DateBuf, 50);