mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	rtsp-client: remove trailing whitespace from header data
Some clients may send headers with trailing whitespace, which can upset subsequent parsing of the data into numbers. This patch removes such trailing whitespace before further processing the header data.
This commit is contained in:
		
							parent
							
								
									fd66fb8867
								
							
						
					
					
						commit
						fa20fb2e80
					
				
					 1 changed files with 9 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -307,7 +307,8 @@ static void process_received_message(struct pw_rtsp_client *client)
 | 
			
		|||
static int process_header(struct pw_rtsp_client *client, char *buf)
 | 
			
		||||
{
 | 
			
		||||
	if (strlen(buf) > 0) {
 | 
			
		||||
		char *key = buf, *value;
 | 
			
		||||
		char *key = buf, *value, *end;
 | 
			
		||||
		size_t len;
 | 
			
		||||
 | 
			
		||||
		value = strstr(buf, ":");
 | 
			
		||||
		if (value == NULL)
 | 
			
		||||
| 
						 | 
				
			
			@ -317,6 +318,13 @@ static int process_header(struct pw_rtsp_client *client, char *buf)
 | 
			
		|||
		while (*value == ' ')
 | 
			
		||||
			value++;
 | 
			
		||||
 | 
			
		||||
		len = strlen(value);
 | 
			
		||||
		if (len > 0) {
 | 
			
		||||
			end = value + len - 1;
 | 
			
		||||
			while (*end == ' ')
 | 
			
		||||
				*end-- = '\0';
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		pw_properties_set(client->headers, key, value);
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue