Project

General

Profile

Actions

Bug #2835

closed

Newline handling of libosmo-mgcp-client needs to be more lenient

Added by daniel over 6 years ago. Updated over 6 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
01/17/2018
Due date:
% Done:

100%

Spec Reference:

Description

The code in mgcp-client assumes certain different line endings on MGCP reponses.

e.g. These don't parse (there's more options):

"200 5 OK\r\nI: 10A96B45\r\n\nv=0\r\no=- foo 21 IN IP4 127.0.0.1\r\ns=-\r\nc=IN IP4 127.0.0.1\r\nt=0 0\r\nm=audio 1000 RTP/AVP 98\r\na=rtpmap:98 AMR/8000\r\na=ptime:20\r\n" 
                        ^^^^^^
"200 5 OK\r\nI: 10A96B45\r\n\r\nv=0\r\no=- foo 21 IN IP4 127.0.0.1\r\ns=-\r\nc=IN IP4 127.0.0.1\r\nt=0 0\r\nm=audio 1000 RTP/AVP 98\r\na=rtpmap:98 AMR/8000\r\na=ptime:20\r\n" 
                        ^^^^^^^^

Only the following is correctly parsed:

"200 5 OK\r\nI: 10A96B45\n\nv=0\r\no=- foo 21 IN IP4 127.0.0.1\r\ns=-\r\nc=IN IP4 127.0.0.1\r\nt=0 0\r\nm=audio 1000 RTP/AVP 98\r\na=rtpmap:98 AMR/8000\r\na=ptime:20\r\n" 

This has to do with the way different parts of the parser search for newlines or double newlines and how they replace parts of the string with NULL.
See parse_head_params(), for_each_non_empty_line and mgcp_response_parse_params() in mgcp_client.c

Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)