mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Don't leak string arguments and options.
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: cmd-string.c,v 1.12 2009-02-08 16:38:19 nicm Exp $ */
 | 
			
		||||
/* $Id: cmd-string.c,v 1.13 2009-02-16 19:29:17 nicm Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -94,6 +94,7 @@ cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause)
 | 
			
		||||
			buf = xrealloc(buf, 1, len + strlen(t) + 1);
 | 
			
		||||
			strlcpy(buf + len, t, strlen(t) + 1);
 | 
			
		||||
			len += strlen(t);
 | 
			
		||||
			xfree(t);
 | 
			
		||||
 | 
			
		||||
			have_arg = 1;
 | 
			
		||||
			break;
 | 
			
		||||
@@ -103,6 +104,7 @@ cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause)
 | 
			
		||||
			buf = xrealloc(buf, 1, len + strlen(t) + 1);
 | 
			
		||||
			strlcpy(buf + len, t, strlen(t) + 1);
 | 
			
		||||
			len += strlen(t);
 | 
			
		||||
			xfree(t);
 | 
			
		||||
 | 
			
		||||
			have_arg = 1;
 | 
			
		||||
			break;
 | 
			
		||||
@@ -145,6 +147,10 @@ cmd_string_parse(const char *s, struct cmd_list **cmdlist, char **cause)
 | 
			
		||||
			if (*cmdlist == NULL)
 | 
			
		||||
				goto out;
 | 
			
		||||
 | 
			
		||||
			do
 | 
			
		||||
				xfree(argv[argc - 1]);
 | 
			
		||||
			while (--argc > 0);
 | 
			
		||||
 | 
			
		||||
			rval = 0;
 | 
			
		||||
			goto out;
 | 
			
		||||
		default:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										7
									
								
								server.c
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								server.c
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: server.c,v 1.122 2009-02-16 18:51:39 nicm Exp $ */
 | 
			
		||||
/* $Id: server.c,v 1.123 2009-02-16 19:29:17 nicm Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -336,6 +336,11 @@ server_main(const char *srv_path, int srv_fd)
 | 
			
		||||
	close(srv_fd);
 | 
			
		||||
	unlink(srv_path);
 | 
			
		||||
 | 
			
		||||
	options_free(&global_options);
 | 
			
		||||
	options_free(&global_window_options);
 | 
			
		||||
	if (server_password != NULL)
 | 
			
		||||
		xfree(server_password);
 | 
			
		||||
 | 
			
		||||
	return (0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user