mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Fix two copy/paste bugs: forbid zero-length buffers to prevent a fatal error
when trying to paste them, found by me, and miscalculation of the start/end causing random fatal errors when copying in copy-mode, reported by sthen.
This commit is contained in:
		
							
								
								
									
										5
									
								
								paste.c
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								paste.c
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: paste.c,v 1.6 2009-01-25 18:51:28 tcunha Exp $ */
 | 
			
		||||
/* $Id: paste.c,v 1.7 2009-07-02 16:23:54 nicm Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -101,6 +101,9 @@ paste_add(struct paste_stack *ps, char *data, u_int limit)
 | 
			
		||||
{
 | 
			
		||||
	struct paste_buffer	*pb;
 | 
			
		||||
 | 
			
		||||
	if (*data == '\0')
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	while (ARRAY_LENGTH(ps) >= limit)
 | 
			
		||||
		ARRAY_TRUNC(ps, 1);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user