diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2019-10-03 10:24:07 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2019-10-03 10:24:07 +0000 |
commit | b87747c4fe6e71e95db497f7affadc746894a60c (patch) | |
tree | 73d62df2aa7db9e23fd6cb4da51bfd6607f2affa | |
parent | 511320566af464d85278c082912b4706fc1464db (diff) |
Do not lazily use BUFSIZ for "I don't care what size" when building
strings because it is only guaranteed to be 256 bytes and even the
default 1024 is not always enough. Reported by Gregory Pakosz.
-rw-r--r-- | usr.bin/tmux/cmd-list-keys.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-parse.y | 6 | ||||
-rw-r--r-- | usr.bin/tmux/cmd.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/layout-custom.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/tty-term.c | 6 |
5 files changed, 12 insertions, 12 deletions
diff --git a/usr.bin/tmux/cmd-list-keys.c b/usr.bin/tmux/cmd-list-keys.c index b240c17c738..b31ca97ef82 100644 --- a/usr.bin/tmux/cmd-list-keys.c +++ b/usr.bin/tmux/cmd-list-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-keys.c,v 1.46 2019/05/23 14:03:44 nicm Exp $ */ +/* $OpenBSD: cmd-list-keys.c,v 1.47 2019/10/03 10:24:05 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -61,7 +61,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmdq_item *item) struct key_table *table; struct key_binding *bd; const char *tablename, *r; - char *key, *cp, tmp[BUFSIZ]; + char *key, *cp, tmp[8192]; int repeat, width, tablewidth, keywidth; if (self->entry == &cmd_list_commands_entry) diff --git a/usr.bin/tmux/cmd-parse.y b/usr.bin/tmux/cmd-parse.y index 93ca1017829..d26bb18029b 100644 --- a/usr.bin/tmux/cmd-parse.y +++ b/usr.bin/tmux/cmd-parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-parse.y,v 1.18 2019/09/10 07:50:33 nicm Exp $ */ +/* $OpenBSD: cmd-parse.y,v 1.19 2019/10/03 10:24:05 nicm Exp $ */ /* * Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -1245,7 +1245,7 @@ yylex_token_variable(char **buf, size_t *len) { struct environ_entry *envent; int ch, brackets = 0; - char name[BUFSIZ]; + char name[1024]; size_t namelen = 0; const char *value; @@ -1297,7 +1297,7 @@ yylex_token_tilde(char **buf, size_t *len) { struct environ_entry *envent; int ch; - char name[BUFSIZ]; + char name[1024]; size_t namelen = 0; struct passwd *pw; const char *home = NULL; diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c index 54b0d23eba1..a70ee5a6644 100644 --- a/usr.bin/tmux/cmd.c +++ b/usr.bin/tmux/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.154 2019/08/29 07:13:48 nicm Exp $ */ +/* $OpenBSD: cmd.c,v 1.155 2019/10/03 10:24:05 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -385,7 +385,7 @@ cmd_find(const char *name, char **cause) { const struct cmd_entry **loop, *entry, *found = NULL; int ambiguous; - char s[BUFSIZ]; + char s[8192]; ambiguous = 0; for (loop = cmd_table; *loop != NULL; loop++) { diff --git a/usr.bin/tmux/layout-custom.c b/usr.bin/tmux/layout-custom.c index 4d6bd34c23d..2d68ad2a752 100644 --- a/usr.bin/tmux/layout-custom.c +++ b/usr.bin/tmux/layout-custom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: layout-custom.c,v 1.15 2019/07/15 18:25:07 nicm Exp $ */ +/* $OpenBSD: layout-custom.c,v 1.16 2019/10/03 10:24:06 nicm Exp $ */ /* * Copyright (c) 2010 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -60,7 +60,7 @@ layout_checksum(const char *layout) char * layout_dump(struct layout_cell *root) { - char layout[BUFSIZ], *out; + char layout[8192], *out; *layout = '\0'; if (layout_append(root, layout, sizeof layout) != 0) diff --git a/usr.bin/tmux/tty-term.c b/usr.bin/tmux/tty-term.c index b71d846717d..609d1151cf7 100644 --- a/usr.bin/tmux/tty-term.c +++ b/usr.bin/tmux/tty-term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-term.c,v 1.67 2019/08/05 06:42:02 nicm Exp $ */ +/* $OpenBSD: tty-term.c,v 1.68 2019/10/03 10:24:06 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -278,7 +278,7 @@ static char * tty_term_strip(const char *s) { const char *ptr; - static char buf[BUFSIZ]; + static char buf[8192]; size_t len; /* Ignore strings with no padding. */ @@ -306,7 +306,7 @@ tty_term_strip(const char *s) static char * tty_term_override_next(const char *s, size_t *offset) { - static char value[BUFSIZ]; + static char value[8192]; size_t n = 0, at = *offset; if (s[at] == '\0') |