diff options
author | "Vladimir N. Oleynik" <dzo@simtreas.ru> | 2006-01-31 09:35:45 +0000 |
---|---|---|
committer | "Vladimir N. Oleynik" <dzo@simtreas.ru> | 2006-01-31 09:35:45 +0000 |
commit | dd14ca082a6e91432993e4d6f31ae75bed58df6e (patch) | |
tree | 9dfa5bd6b7afd03850341ec4aaa82de8f202b742 | |
parent | 4ccd2b46975df7b06b9d162fac4ac06dba0bdad4 (diff) | |
download | busybox-w32-dd14ca082a6e91432993e4d6f31ae75bed58df6e.tar.gz busybox-w32-dd14ca082a6e91432993e4d6f31ae75bed58df6e.tar.bz2 busybox-w32-dd14ca082a6e91432993e4d6f31ae75bed58df6e.zip |
protect potential overflow for x86_64
-rw-r--r-- | miscutils/last.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/miscutils/last.c b/miscutils/last.c index d7ce5e775..72386ea94 100644 --- a/miscutils/last.c +++ b/miscutils/last.c | |||
@@ -47,6 +47,7 @@ extern int last_main(int argc, char **argv) | |||
47 | { | 47 | { |
48 | struct utmp ut; | 48 | struct utmp ut; |
49 | int n, file = STDIN_FILENO; | 49 | int n, file = STDIN_FILENO; |
50 | time_t t_tmp; | ||
50 | 51 | ||
51 | if (argc > 1) { | 52 | if (argc > 1) { |
52 | bb_show_usage(); | 53 | bb_show_usage(); |
@@ -98,9 +99,9 @@ extern int last_main(int argc, char **argv) | |||
98 | break; | 99 | break; |
99 | } | 100 | } |
100 | } | 101 | } |
101 | 102 | t_tmp = (time_t)ut.ut_tv.tv_sec; | |
102 | printf("%-10s %-14s %-18s %-12.12s\n", ut.ut_user, ut.ut_line, ut.ut_host, | 103 | printf("%-10s %-14s %-18s %-12.12s\n", ut.ut_user, ut.ut_line, ut.ut_host, |
103 | ctime((time_t *)&(ut.ut_tv.tv_sec)) + 4); | 104 | ctime(&t_tmp) + 4); |
104 | } | 105 | } |
105 | 106 | ||
106 | bb_fflush_stdout_and_exit(EXIT_SUCCESS); | 107 | bb_fflush_stdout_and_exit(EXIT_SUCCESS); |