summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/datetime.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/datetime.c b/src/datetime.c
index ffc3329..08ed9a6 100644
--- a/src/datetime.c
+++ b/src/datetime.c
@@ -142,7 +142,7 @@ datetime_parse(struct tm *now_tm, const char *input, time_t *arg_sec)
sec = *arg_sec; /* GCC is dumb. */
got = false;
for (t = 0; t < sizeof(FORMATS_TIME) / sizeof(FORMATS_TIME[0]) ; ++t) {
- memcpy(fmt_buf, FORMATS_TIME[t], time_fmt_len);
+ memcpy(fmt_buf, FORMATS_TIME[t], time_fmt_len + 1);
_datetime_reset_tm(&arg_tm);
end = strptime(input, fmt_buf, &arg_tm);
if (end != NULL && *end == '\0') {
@@ -159,11 +159,11 @@ datetime_parse(struct tm *now_tm, const char *input, time_t *arg_sec)
if (FORMATS_DATE[d][0] == '\0') {
break;
}
- memcpy(fmt_buf, FORMATS_DATE[d], date_fmt_len);
+ memcpy(fmt_buf, FORMATS_DATE[d], date_fmt_len + 1);
for (t = 0; t < sizeof(FORMATS_TIME) / sizeof(FORMATS_TIME[0]);
++t) {
memcpy(fmt_buf + date_fmt_len, FORMATS_TIME[t],
- time_fmt_len);
+ time_fmt_len + 1);
_datetime_reset_tm(&arg_tm);
end = strptime(input, fmt_buf, &arg_tm);
if (end != NULL && *end == '\0') {
@@ -178,14 +178,14 @@ datetime_parse(struct tm *now_tm, const char *input, time_t *arg_sec)
}
}
for (t = 0; t < sizeof(FORMATS_TIME) / sizeof(FORMATS_TIME[0]); ++t) {
- memcpy(fmt_buf, FORMATS_TIME[t], time_fmt_len);
+ memcpy(fmt_buf, FORMATS_TIME[t], time_fmt_len + 1);
for (d = 0; d < sizeof(FORMATS_DATE) / sizeof(FORMATS_DATE[0]);
++d) {
if (FORMATS_DATE[d][0] == '\0') {
break;
}
memcpy(fmt_buf + time_fmt_len, FORMATS_DATE[d],
- date_fmt_len);
+ date_fmt_len + 1);
_datetime_reset_tm(&arg_tm);
end = strptime(input, fmt_buf, &arg_tm);
if (end != NULL && *end == '\0') {
@@ -200,7 +200,7 @@ datetime_parse(struct tm *now_tm, const char *input, time_t *arg_sec)
}
}
for (d = 0; d < sizeof(FORMATS_MISC) / sizeof(FORMATS_MISC[0]) ; ++d) {
- memcpy(fmt_buf, FORMATS_MISC[d], misc_fmt_len);
+ memcpy(fmt_buf, FORMATS_MISC[d], misc_fmt_len + 1);
_datetime_reset_tm(&arg_tm);
end = strptime(input, fmt_buf, &arg_tm);
if (end != NULL && *end == '\0') {