summaryrefslogtreecommitdiffstats
path: root/src/basic/time-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/basic/time-util.c')
-rw-r--r--src/basic/time-util.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/basic/time-util.c b/src/basic/time-util.c
index f4022f7c86..b659d6905d 100644
--- a/src/basic/time-util.c
+++ b/src/basic/time-util.c
@@ -671,7 +671,7 @@ static int parse_timestamp_impl(const char *t, usec_t *usec, bool with_tz) {
goto finish;
} else if ((k = endswith(t, " ago"))) {
- t = strndupa(t, k - t);
+ t = strndupa_safe(t, k - t);
r = parse_sec(t, &minus);
if (r < 0)
@@ -680,7 +680,7 @@ static int parse_timestamp_impl(const char *t, usec_t *usec, bool with_tz) {
goto finish;
} else if ((k = endswith(t, " left"))) {
- t = strndupa(t, k - t);
+ t = strndupa_safe(t, k - t);
r = parse_sec(t, &plus);
if (r < 0)
@@ -692,7 +692,7 @@ static int parse_timestamp_impl(const char *t, usec_t *usec, bool with_tz) {
/* See if the timestamp is suffixed with UTC */
utc = endswith_no_case(t, " UTC");
if (utc)
- t = strndupa(t, utc - t);
+ t = strndupa_safe(t, utc - t);
else {
const char *e = NULL;
int j;
@@ -723,7 +723,7 @@ static int parse_timestamp_impl(const char *t, usec_t *usec, bool with_tz) {
if (IN_SET(j, 0, 1)) {
/* Found one of the two timezones specified. */
- t = strndupa(t, e - t - 1);
+ t = strndupa_safe(t, e - t - 1);
dst = j;
tzn = tzname[j];
}
@@ -924,7 +924,7 @@ int parse_timestamp(const char *t, usec_t *usec) {
/* Cut off the timezone if we don't need it. */
if (with_tz)
- t = strndupa(t, last_space - t);
+ t = strndupa_safe(t, last_space - t);
shared->return_value = parse_timestamp_impl(t, &shared->usec, with_tz);