diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2012-01-26 09:05:55 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2012-01-26 09:05:55 +0000 |
commit | 4bcdd427695439735df60bc3e9cdef2fc555612b (patch) | |
tree | ad8add4af4c52c678be93855717308fe0a9e79e4 /usr.bin | |
parent | 57f7c1fd1f4bcc7eadaf1dc9bc19c54df55687a4 (diff) |
Terminate strftime buffer properly even if a really long format string
is given, from Tiago Cunha.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tmux/status.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/tmux/status.c b/usr.bin/tmux/status.c index 19f65e42163..8c5355edd40 100644 --- a/usr.bin/tmux/status.c +++ b/usr.bin/tmux/status.c @@ -1,4 +1,4 @@ -/* $OpenBSD: status.c,v 1.85 2012/01/26 09:03:09 nicm Exp $ */ +/* $OpenBSD: status.c,v 1.86 2012/01/26 09:05:54 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -491,9 +491,10 @@ status_replace(struct client *c, struct session *s, struct winlink *wl, { static char out[BUFSIZ]; char in[BUFSIZ], ch, *iptr, *optr; + size_t len; - strftime(in, sizeof in, fmt, localtime(&t)); - in[(sizeof in) - 1] = '\0'; + len = strftime(in, sizeof in, fmt, localtime(&t)); + in[len] = '\0'; iptr = in; optr = out; |