mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Need to include message size in the maximum buffer calculation.
This commit is contained in:
		
							
								
								
									
										4
									
								
								client.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								client.c
									
									
									
									
									
								
							@@ -601,8 +601,8 @@ client_read_callback(__unused struct bufferevent *bev, void *arg)
 | 
			
		||||
 | 
			
		||||
		if (bsize == 0)
 | 
			
		||||
			break;
 | 
			
		||||
		if (bsize > MAX_IMSGSIZE - IMSG_HEADER_SIZE)
 | 
			
		||||
			bsize = MAX_IMSGSIZE - IMSG_HEADER_SIZE;
 | 
			
		||||
		if (bsize > MAX_IMSGSIZE - IMSG_HEADER_SIZE - sizeof *msg)
 | 
			
		||||
			bsize = MAX_IMSGSIZE - IMSG_HEADER_SIZE - sizeof *msg;
 | 
			
		||||
		log_debug("read %zu from file %d", bsize, cf->stream);
 | 
			
		||||
 | 
			
		||||
		msglen = (sizeof *msg) + bsize;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								file.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								file.c
									
									
									
									
									
								
							@@ -376,8 +376,8 @@ file_push(struct client_file *cf)
 | 
			
		||||
	left = EVBUFFER_LENGTH(cf->buffer);
 | 
			
		||||
	while (left != 0) {
 | 
			
		||||
		sent = left;
 | 
			
		||||
		if (sent > MAX_IMSGSIZE - IMSG_HEADER_SIZE)
 | 
			
		||||
			sent = MAX_IMSGSIZE - IMSG_HEADER_SIZE;
 | 
			
		||||
		if (sent > MAX_IMSGSIZE - IMSG_HEADER_SIZE - sizeof *msg)
 | 
			
		||||
			sent = MAX_IMSGSIZE - IMSG_HEADER_SIZE - sizeof *msg;
 | 
			
		||||
 | 
			
		||||
		msglen = (sizeof *msg) + sent;
 | 
			
		||||
		msg = xrealloc(msg, msglen);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user