From 846cdbdbf965fc50478bcc4c6436e3dc6a489f3f Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Thu, 14 Oct 2021 19:01:18 -0400 Subject: Initial commit. --- .../modem-manager-gui/files/mm-strftime-null.patch | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 net-misc/modem-manager-gui/files/mm-strftime-null.patch (limited to 'net-misc/modem-manager-gui/files') diff --git a/net-misc/modem-manager-gui/files/mm-strftime-null.patch b/net-misc/modem-manager-gui/files/mm-strftime-null.patch new file mode 100644 index 0000000..b73e028 --- /dev/null +++ b/net-misc/modem-manager-gui/files/mm-strftime-null.patch @@ -0,0 +1,52 @@ +# HG changeset patch +# User Alex +# Date 1558782045 -10800 +# Node ID 83553d042443c71be71533b6b91ee10f228d935f +# Parent de113e8953ae708043823578b64882cfc5a45ca2 +Fix segfault in strftime_l() because of timestamps from future + +diff --git a/src/strformat.c b/src/strformat.c +--- a/src/strformat.c ++++ b/src/strformat.c +@@ -1,7 +1,7 @@ + /* + * strformat.c + * +- * Copyright 2013-2014 Alex ++ * Copyright 2013-2019 Alex + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +@@ -182,18 +182,22 @@ + + memset(buffer, 0, bufsize); + +- if (delta <= 0.0) { +- if (strftime(buffer, bufsize, _("Today, %T"), ftime) == 0) { +- g_snprintf(buffer, bufsize, _("Unknown")); +- } +- } else if ((delta > 0.0) && (delta < 86400.0)) { +- if (strftime(buffer, bufsize, _("Yesterday, %T"), ftime) == 0) { +- g_snprintf(buffer, bufsize, _("Unknown")); ++ if (ftime != NULL) { ++ if (delta <= 0.0) { ++ if (strftime(buffer, bufsize, _("Today, %T"), ftime) == 0) { ++ g_snprintf(buffer, bufsize, _("Unknown")); ++ } ++ } else if ((delta > 0.0) && (delta < 86400.0)) { ++ if (strftime(buffer, bufsize, _("Yesterday, %T"), ftime) == 0) { ++ g_snprintf(buffer, bufsize, _("Unknown")); ++ } ++ } else { ++ if (strftime(buffer, bufsize, _("%d %B %Y, %T"), ftime) == 0) { ++ g_snprintf(buffer, bufsize, _("Unknown")); ++ } + } + } else { +- if (strftime(buffer, bufsize, _("%d %B %Y, %T"), ftime) == 0) { +- g_snprintf(buffer, bufsize, _("Unknown")); +- } ++ g_snprintf(buffer, bufsize, _("Unknown")); + } + + return buffer; \ No newline at end of file -- cgit v1.2.3