diff options
author | tegge <tegge@FreeBSD.org> | 1997-06-23 22:09:15 +0000 |
---|---|---|
committer | tegge <tegge@FreeBSD.org> | 1997-06-23 22:09:15 +0000 |
commit | 9c1e6b87a17c4ee43c330d4324e6dfa50ddc037e (patch) | |
tree | 8e78e4a19b7f56709bcf07de0555454378262d51 | |
parent | 8131710f9d0f72548103ed9c67c16e40341142e6 (diff) | |
download | FreeBSD-src-9c1e6b87a17c4ee43c330d4324e6dfa50ddc037e.zip FreeBSD-src-9c1e6b87a17c4ee43c330d4324e6dfa50ddc037e.tar.gz |
Long command names are not NUL terminated. Force truncation in format string.
-rw-r--r-- | usr.bin/lastcomm/lastcomm.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/lastcomm/lastcomm.c b/usr.bin/lastcomm/lastcomm.c index 0edb091..6d7b034 100644 --- a/usr.bin/lastcomm/lastcomm.c +++ b/usr.bin/lastcomm/lastcomm.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: lastcomm.c,v 1.6 1997/02/22 19:55:33 peter Exp $ + * $Id: lastcomm.c,v 1.7 1997/03/29 04:30:24 imp Exp $ */ #ifndef lint @@ -175,7 +175,8 @@ main(argc, argv) if (*argv && !requested(argv, &ab)) continue; - (void)printf("%-*s %-7s %-*s %-*s ", + (void)printf("%-*.*s %-7s %-*s %-*s ", + fldsiz(acct, ac_comm), fldsiz(acct, ac_comm), ab.ac_comm, flagbits(ab.ac_flag), UT_NAMESIZE, user_from_uid(ab.ac_uid, 0), |