mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	module-rtp: fix SAP header parsing for IPv6
If the originating source is IPv6, the A bit is set and the source is 16 bytes compared to 4 bytes for IPv4. Fixes #3851
This commit is contained in:
		
							parent
							
								
									e15b9e7f71
								
							
						
					
					
						commit
						c37c6b0789
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
					@ -1423,7 +1423,7 @@ static int parse_sap(struct impl *impl, void *data, size_t len)
 | 
				
			||||||
	if (header->c)
 | 
						if (header->c)
 | 
				
			||||||
		return -ENOTSUP;
 | 
							return -ENOTSUP;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	offs = header->a ? 12 : 8;
 | 
						offs = header->a ? 20 : 8;
 | 
				
			||||||
	offs += header->auth_len * 4;
 | 
						offs += header->auth_len * 4;
 | 
				
			||||||
	if (len <= offs)
 | 
						if (len <= offs)
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
| 
						 | 
					@ -1463,6 +1463,7 @@ static void
 | 
				
			||||||
on_sap_io(void *data, int fd, uint32_t mask)
 | 
					on_sap_io(void *data, int fd, uint32_t mask)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct impl *impl = data;
 | 
						struct impl *impl = data;
 | 
				
			||||||
 | 
						int res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (mask & SPA_IO_IN) {
 | 
						if (mask & SPA_IO_IN) {
 | 
				
			||||||
		uint8_t buffer[2048];
 | 
							uint8_t buffer[2048];
 | 
				
			||||||
| 
						 | 
					@ -1476,7 +1477,8 @@ on_sap_io(void *data, int fd, uint32_t mask)
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		buffer[len] = 0;
 | 
							buffer[len] = 0;
 | 
				
			||||||
		parse_sap(impl, buffer, len);
 | 
							if ((res = parse_sap(impl, buffer, len)) < 0)
 | 
				
			||||||
 | 
								pw_log_warn("error parsing SAP: %s", spa_strerror(res));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue