mirror of
				https://github.com/tmux/tmux.git
				synced 2025-10-26 12:27:15 +00:00 
			
		
		
		
	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.
This commit is contained in:
		| @@ -61,7 +61,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmdq_item *item) | |||||||
| 	struct key_table	*table; | 	struct key_table	*table; | ||||||
| 	struct key_binding	*bd; | 	struct key_binding	*bd; | ||||||
| 	const char		*tablename, *r; | 	const char		*tablename, *r; | ||||||
| 	char			*key, *cp, tmp[BUFSIZ]; | 	char			*key, *cp, tmp[8192]; | ||||||
| 	int			 repeat, width, tablewidth, keywidth; | 	int			 repeat, width, tablewidth, keywidth; | ||||||
|  |  | ||||||
| 	if (self->entry == &cmd_list_commands_entry) | 	if (self->entry == &cmd_list_commands_entry) | ||||||
|   | |||||||
| @@ -1245,7 +1245,7 @@ yylex_token_variable(char **buf, size_t *len) | |||||||
| { | { | ||||||
| 	struct environ_entry	*envent; | 	struct environ_entry	*envent; | ||||||
| 	int			 ch, brackets = 0; | 	int			 ch, brackets = 0; | ||||||
| 	char			 name[BUFSIZ]; | 	char			 name[1024]; | ||||||
| 	size_t			 namelen = 0; | 	size_t			 namelen = 0; | ||||||
| 	const char		*value; | 	const char		*value; | ||||||
|  |  | ||||||
| @@ -1297,7 +1297,7 @@ yylex_token_tilde(char **buf, size_t *len) | |||||||
| { | { | ||||||
| 	struct environ_entry	*envent; | 	struct environ_entry	*envent; | ||||||
| 	int			 ch; | 	int			 ch; | ||||||
| 	char			 name[BUFSIZ]; | 	char			 name[1024]; | ||||||
| 	size_t			 namelen = 0; | 	size_t			 namelen = 0; | ||||||
| 	struct passwd		*pw; | 	struct passwd		*pw; | ||||||
| 	const char		*home = NULL; | 	const char		*home = NULL; | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								cmd.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								cmd.c
									
									
									
									
									
								
							| @@ -385,7 +385,7 @@ cmd_find(const char *name, char **cause) | |||||||
| { | { | ||||||
| 	const struct cmd_entry	**loop, *entry, *found = NULL; | 	const struct cmd_entry	**loop, *entry, *found = NULL; | ||||||
| 	int			  ambiguous; | 	int			  ambiguous; | ||||||
| 	char			  s[BUFSIZ]; | 	char			  s[8192]; | ||||||
|  |  | ||||||
| 	ambiguous = 0; | 	ambiguous = 0; | ||||||
| 	for (loop = cmd_table; *loop != NULL; loop++) { | 	for (loop = cmd_table; *loop != NULL; loop++) { | ||||||
|   | |||||||
| @@ -60,7 +60,7 @@ layout_checksum(const char *layout) | |||||||
| char * | char * | ||||||
| layout_dump(struct layout_cell *root) | layout_dump(struct layout_cell *root) | ||||||
| { | { | ||||||
| 	char	layout[BUFSIZ], *out; | 	char	layout[8192], *out; | ||||||
|  |  | ||||||
| 	*layout = '\0'; | 	*layout = '\0'; | ||||||
| 	if (layout_append(root, layout, sizeof layout) != 0) | 	if (layout_append(root, layout, sizeof layout) != 0) | ||||||
|   | |||||||
| @@ -278,7 +278,7 @@ static char * | |||||||
| tty_term_strip(const char *s) | tty_term_strip(const char *s) | ||||||
| { | { | ||||||
| 	const char     *ptr; | 	const char     *ptr; | ||||||
| 	static char	buf[BUFSIZ]; | 	static char	buf[8192]; | ||||||
| 	size_t		len; | 	size_t		len; | ||||||
|  |  | ||||||
| 	/* Ignore strings with no padding. */ | 	/* Ignore strings with no padding. */ | ||||||
| @@ -306,7 +306,7 @@ tty_term_strip(const char *s) | |||||||
| static char * | static char * | ||||||
| tty_term_override_next(const char *s, size_t *offset) | tty_term_override_next(const char *s, size_t *offset) | ||||||
| { | { | ||||||
| 	static char	value[BUFSIZ]; | 	static char	value[8192]; | ||||||
| 	size_t		n = 0, at = *offset; | 	size_t		n = 0, at = *offset; | ||||||
|  |  | ||||||
| 	if (s[at] == '\0') | 	if (s[at] == '\0') | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 nicm
					nicm