From bfba265009610e84af4f8e4b1b3f05ec3a2d56bc Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Wed, 5 Oct 2022 08:41:26 +0000 Subject: libmm-glib,common-helpers: don't assume new_from_unix_utc() always succeeds The g_date_time_new_from_unix_utc() method in glib2 may fail if the given timestamp is too far into the future. The value is supposed to be seconds since unix time origin, but internally it will be converted into usecs, so any value longer than G_MAXINT64 / USEC_PER_SECOND isn't allowed. This is currently used in the CLI, and we're anyway ignoring the error returned in that case, but at least it won't crash if it ever happens. --- cli/mmcli-output.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cli/mmcli-output.c') diff --git a/cli/mmcli-output.c b/cli/mmcli-output.c index 1bb17f82..ef1c7cb3 100644 --- a/cli/mmcli-output.c +++ b/cli/mmcli-output.c @@ -621,11 +621,11 @@ mmcli_output_signal_quality (MMModemState state, /* (Custom) Bearer start date output */ void -mmcli_output_start_date (guint64 value) +mmcli_output_start_date (guint64 value) { /* Merge value and recent flag in a single item in human output */ if (selected_type == MMC_OUTPUT_TYPE_HUMAN) { - output_item_new_take_single (MMC_F_BEARER_STATS_START_DATE, mm_new_iso8601_time_from_unix_time (value)); + output_item_new_take_single (MMC_F_BEARER_STATS_START_DATE, mm_new_iso8601_time_from_unix_time (value, NULL)); return; } -- cgit v1.2.3-70-g09d2