Skip to content

Commit

Permalink
Fixed parsing of MRCP messages containing leading whitespace(s) in th…
Browse files Browse the repository at this point in the history
…e message body.
  • Loading branch information
achaloyan committed Dec 13, 2017
1 parent c5a77ea commit 3f28cf1
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions libs/apr-toolkit/src/apt_text_message.c
Expand Up @@ -62,26 +62,28 @@ APT_DECLARE(apt_header_field_t*) apt_header_field_parse(apt_text_stream_t *strea
return NULL;
}

/* check folding lines (value spanning multiple lines) */
while(stream->pos < stream->end) {
if(apt_text_is_wsp(*stream->pos) == FALSE) {
break;
}
if (apt_string_is_empty(&pair.name) == FALSE) {
/* check folding lines (value spanning multiple lines) */
while (stream->pos < stream->end) {
if (apt_text_is_wsp(*stream->pos) == FALSE) {
break;
}

stream->pos++;
stream->pos++;

/* skip further white spaces (if any) */
apt_text_white_spaces_skip(stream);
/* skip further white spaces (if any) */
apt_text_white_spaces_skip(stream);

if(!folded_lines) {
folded_lines = apr_array_make(pool,1,sizeof(apt_str_t));
}
if(apt_text_line_read(stream,&temp_line) == TRUE) {
line = apr_array_push(folded_lines);
*line = temp_line;
folding_length += line->length;
if (!folded_lines) {
folded_lines = apr_array_make(pool, 1, sizeof(apt_str_t));
}
if (apt_text_line_read(stream, &temp_line) == TRUE) {
line = apr_array_push(folded_lines);
*line = temp_line;
folding_length += line->length;
}
}
};
}

header_field = apt_header_field_alloc(pool);
/* copy parsed name of the header field */
Expand Down

0 comments on commit 3f28cf1

Please sign in to comment.