Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144300819
D11660.id30973.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1000 B
Referenced Files
None
Subscribers
None
D11660.id30973.diff
View Options
Index: bin/date/date.c
===================================================================
--- bin/date/date.c
+++ bin/date/date.c
@@ -85,7 +85,7 @@
int set_timezone;
struct vary *v;
const struct vary *badv;
- struct tm lt;
+ struct tm *lt;
struct stat sb;
v = NULL;
@@ -174,8 +174,10 @@
if (*argv && **argv == '+')
format = *argv + 1;
- lt = *localtime(&tval);
- badv = vary_apply(v, <);
+ lt = localtime(&tval);
+ if (lt == NULL)
+ errx(1, "invalid time");
+ badv = vary_apply(v, lt);
if (badv) {
fprintf(stderr, "%s: Cannot apply date adjustment\n",
badv->arg);
@@ -191,7 +193,7 @@
*/
setlocale(LC_TIME, "C");
- (void)strftime(buf, sizeof(buf), format, <);
+ (void)strftime(buf, sizeof(buf), format, lt);
(void)printf("%s\n", buf);
if (fflush(stdout))
err(1, "stdout");
@@ -210,6 +212,8 @@
int century;
lt = localtime(&tval);
+ (if ld == NULL)
+ errx(1, "invalid time");
lt->tm_isdst = -1; /* divine correct DST */
if (fmt != NULL) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Feb 8, 5:42 PM (10 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28480147
Default Alt Text
D11660.id30973.diff (1000 B)
Attached To
Mode
D11660: date: avoid crash on invalid time
Attached
Detach File
Event Timeline
Log In to Comment