aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 *