-/* $OpenBSD: ftpcmd.y,v 1.74 2023/03/08 04:43:05 guenther Exp $ */
+/* $OpenBSD: ftpcmd.y,v 1.75 2024/04/28 16:42:53 florian Exp $ */
/* $NetBSD: ftpcmd.y,v 1.7 1996/04/08 19:03:11 jtc Exp $ */
/*
} else {
struct tm *t;
t = gmtime(&stbuf.st_mtime);
+ if (t == NULL) {
+ /* invalid time, use epoch */
+ stbuf.st_mtime = 0;
+ t = gmtime(&stbuf.st_mtime);
+ }
reply(213,
"%04d%02d%02d%02d%02d%02d",
1900 + t->tm_year,
-/* $OpenBSD: main.c,v 1.54 2019/06/28 13:32:53 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.55 2024/04/28 16:42:53 florian Exp $ */
/*-
* Copyright (c) 1980, 1993
break;
case 'd': {
- (void)time(&t);
- (void)strftime(db, sizeof(db),
- "%l:%M%p on %A, %d %B %Y", localtime(&t));
- xputs(db);
+ struct tm *tm;
+ time(&t);
+ if ((tm = localtime(&t)) != NULL)
+ if (strftime(db, sizeof(db),
+ "%l:%M%p on %A, %d %B %Y", tm) != 0)
+ xputs(db);
break;
}
-/* $OpenBSD: mib.c,v 1.7 2023/11/21 08:49:08 martijn Exp $ */
+/* $OpenBSD: mib.c,v 1.8 2024/04/28 16:42:53 florian Exp $ */
/*
* Copyright (c) 2022 Martijn van Duren <martijn@openbsd.org>
int tzoffset;
unsigned short year;
+ memset(s, 0, sizeof(s));
(void)time(&now);
ptm = localtime(&now);
- year = htons(ptm->tm_year + 1900);
- memcpy(s, &year, 2);
- s[2] = ptm->tm_mon + 1;
- s[3] = ptm->tm_mday;
- s[4] = ptm->tm_hour;
- s[5] = ptm->tm_min;
- s[6] = ptm->tm_sec;
- s[7] = 0;
-
- tzoffset = ptm->tm_gmtoff;
- if (tzoffset < 0)
- s[8] = '-';
- else
- s[8] = '+';
-
- s[9] = abs(tzoffset) / 3600;
- s[10] = (abs(tzoffset) - (s[9] * 3600)) / 60;
+ if (ptm != NULL) {
+ year = htons(ptm->tm_year + 1900);
+ memcpy(s, &year, 2);
+ s[2] = ptm->tm_mon + 1;
+ s[3] = ptm->tm_mday;
+ s[4] = ptm->tm_hour;
+ s[5] = ptm->tm_min;
+ s[6] = ptm->tm_sec;
+ s[7] = 0;
+
+ tzoffset = ptm->tm_gmtoff;
+ if (tzoffset < 0)
+ s[8] = '-';
+ else
+ s[8] = '+';
+ s[9] = abs(tzoffset) / 3600;
+ s[10] = (abs(tzoffset) - (s[9] * 3600)) / 60;
+ }
agentx_varbind_nstring(vb, s, sizeof(s));
}
-/* $OpenBSD: announce.c,v 1.25 2019/06/28 13:32:53 deraadt Exp $ */
+/* $OpenBSD: announce.c,v 1.26 2024/04/28 16:42:53 florian Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
sizes[i] = strlen(line_buf[i]);
max_size = max(max_size, sizes[i]);
i++;
- (void)snprintf(line_buf[i], N_CHARS,
- "Message from Talk_Daemon@%s at %d:%02d ...",
- hostname, localclock->tm_hour , localclock->tm_min );
+ if (localclock) {
+ (void)snprintf(line_buf[i], N_CHARS,
+ "Message from Talk_Daemon@%s at %d:%02d ...",
+ hostname, localclock->tm_hour , localclock->tm_min );
+ } else {
+ (void)snprintf(line_buf[i], N_CHARS,
+ "Message from Talk_Daemon@%s ...", hostname);
+ }
sizes[i] = strlen(line_buf[i]);
max_size = max(max_size, sizes[i]);
i++;