aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/utils.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2026-03-07 23:34:48 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2026-03-07 23:34:48 +0100
commit5a3df2f6bd2e9a40be8774d111988b2265c27f3e (patch)
tree556d0099e48031be4d5c40c4e8451b39c58426ec /FICS/utils.c
parenta83a95e285273ee2cb8ab3cec810fbfbc435354d (diff)
strtime: check the return value of strftime()
Diffstat (limited to 'FICS/utils.c')
-rw-r--r--FICS/utils.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/FICS/utils.c b/FICS/utils.c
index 2399a03..20aae1a 100644
--- a/FICS/utils.c
+++ b/FICS/utils.c
@@ -825,15 +825,23 @@ hms(int t, int showhour, int showseconds, int spaces)
}
PRIVATE char *
-strtime(struct tm * stm)
+strtime(struct tm *stm)
{
- static char tstr[100];
+ static char tstr[100] = { '\0' };
+
#if defined (SGI)
- strftime(tstr, sizeof(tstr), "%a %b %e, %H:%M %Z", stm);
+ if (strftime(tstr, sizeof(tstr), "%a %b %e, %H:%M %Z", stm) == 0) {
+ memset(tstr, 0, sizeof(tstr));
+ return &tstr[0];
+ }
#else
- strftime(tstr, sizeof(tstr), "%a %b %e, %k:%M %Z", stm);
+ if (strftime(tstr, sizeof(tstr), "%a %b %e, %k:%M %Z", stm) == 0) {
+ memset(tstr, 0, sizeof(tstr));
+ return &tstr[0];
+ }
#endif
- return (tstr);
+
+ return (&tstr[0]);
}
PUBLIC char *