File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -409,6 +409,12 @@ int sdp_ops_parse_lines(struct sdp_body_part_ops *ops, str *body)
409409 if (* p != sep || (sep_len == 2 && p < (lim - 1 ) && * (p + 1 ) != '\n' ))
410410 continue ;
411411
412+ if (i >= SDP_MAX_LINES ) {
413+ LM_ERR ("SDP body exceeds maximum line count (%d)\n" ,
414+ SDP_MAX_LINES );
415+ return -1 ;
416+ }
417+
412418 /* lines are stored *without* the ending separator */
413419 ops -> lines [i ].line .s = start ;
414420 ops -> lines [i ].line .len = p - start ;
@@ -419,6 +425,12 @@ int sdp_ops_parse_lines(struct sdp_body_part_ops *ops, str *body)
419425
420426 /* edge-case: the very last SDP line does not include a separator... */
421427 if (start < lim ) {
428+ if (i >= SDP_MAX_LINES ) {
429+ LM_ERR ("SDP body exceeds maximum line count (%d)\n" ,
430+ SDP_MAX_LINES );
431+ return -1 ;
432+ }
433+
422434 ops -> lines [i ].line .s = start ;
423435 ops -> lines [i ].line .len = p - start ;
424436 ops -> lines [i ++ ].newbuf = 0 ;
You can’t perform that action at this time.
0 commit comments