mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	|---------------------
|PatchSet 781 |Date: 2010/10/29 21:11:57 |Author: nicm |Branch: HEAD |Tag: (none) |Log: |We now send argv to the server after parsing it in the client to get the |command, so the client should not modify it. Instead, take a copy. Fixes |parsing command lists, reported by mcbride@. | |Members: | cmd-list.c:1.5->1.6 | cmd.c:1.45->1.46 | tmux.h:1.244->1.245
This commit is contained in:
		
							
								
								
									
										18
									
								
								cmd.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								cmd.c
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: cmd.c,v 1.144 2010-10-24 01:34:30 tcunha Exp $ */
 | 
			
		||||
/* $Id: cmd.c,v 1.145 2010-12-06 21:48:56 nicm Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -165,6 +165,22 @@ cmd_unpack_argv(char *buf, size_t len, int argc, char ***argv)
 | 
			
		||||
	return (0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
char **
 | 
			
		||||
cmd_copy_argv(int argc, char **argv)
 | 
			
		||||
{
 | 
			
		||||
	char	**new_argv;
 | 
			
		||||
	int	  i;
 | 
			
		||||
 | 
			
		||||
	if (argc == 0)
 | 
			
		||||
		return (NULL);
 | 
			
		||||
	new_argv = xcalloc(argc, sizeof *new_argv);
 | 
			
		||||
	for (i = 0; i < argc; i++) {
 | 
			
		||||
		if (argv[i] != NULL)
 | 
			
		||||
			new_argv[i] = xstrdup(argv[i]);
 | 
			
		||||
	}
 | 
			
		||||
	return (new_argv);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
cmd_free_argv(int argc, char **argv)
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user