summaryrefslogtreecommitdiff
path: root/net-misc/modem-manager-gui/files/mm-strftime-null.patch
diff options
context:
space:
mode:
Diffstat (limited to 'net-misc/modem-manager-gui/files/mm-strftime-null.patch')
-rw-r--r--net-misc/modem-manager-gui/files/mm-strftime-null.patch52
1 files changed, 52 insertions, 0 deletions
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 <alex@linuxonly.ru>
+# 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 <alex@linuxonly.ru>
++ * Copyright 2013-2019 Alex <alex@linuxonly.ru>
+ *
+ * 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