mirror of
				https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
				synced 2025-11-03 21:43:32 +00:00 
			
		
		
		
	mgcp_protocol: increase buffer space for codec name in LCO
The function that parses the LCO uses an internal buffer to store the codec name that has been issued via LCO. This buffer is only 9 byte long, this means an 8 character string can be stored. If a codec name exceeds this limit it gets chopped. For example "GSM-HR-08" becomes "GSM-HR-0", which may mess up the codec negotiation. - Increase the buffer from 9 to 17 byte. Change-Id: I17ce7acde1f23ab1394227d74214fe2a55cd2264 Related: OS#3673
This commit is contained in:
		@@ -579,7 +579,7 @@ static int set_local_cx_options(void *ctx, struct mgcp_lco *lco,
 | 
				
			|||||||
				 const char *options)
 | 
									 const char *options)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char *p_opt, *a_opt;
 | 
						char *p_opt, *a_opt;
 | 
				
			||||||
	char codec[9];
 | 
						char codec[17];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!options)
 | 
						if (!options)
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
@@ -605,7 +605,7 @@ static int set_local_cx_options(void *ctx, struct mgcp_lco *lco,
 | 
				
			|||||||
	 * (e.g. a:PCMU;G726-32) But this implementation only supports a single
 | 
						 * (e.g. a:PCMU;G726-32) But this implementation only supports a single
 | 
				
			||||||
	 * codec only. */
 | 
						 * codec only. */
 | 
				
			||||||
	a_opt = strstr(lco->string, "a:");
 | 
						a_opt = strstr(lco->string, "a:");
 | 
				
			||||||
	if (a_opt && sscanf(a_opt, "a:%8[^,]", codec) == 1) {
 | 
						if (a_opt && sscanf(a_opt, "a:%16[^,]", codec) == 1) {
 | 
				
			||||||
		talloc_free(lco->codec);
 | 
							talloc_free(lco->codec);
 | 
				
			||||||
		lco->codec = talloc_strdup(ctx, codec);
 | 
							lco->codec = talloc_strdup(ctx, codec);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user