@miconda commented on this pull request.


> +                     del_offset = body->display.s - msg->buf;
+                       del_len = body->display.len;
+                       /* extend backward to include all spaces before display 
*/
+                       p = body->display.s - 1;
+                       while(p >= msg->buf && isspace(*p)) {
+                               del_offset--;
+                               del_len++;
+                               p--;
+                       }
+                       /* extend forward to include all spaces after display */
+                       p = body->display.s + body->display.len;
+               } else {
+                       /* no existing display - check spaces after colon
+                        * hdr->name is "To"/"From" without ':', skip past it */
+                       del_offset = (hdr->name.s + hdr->name.len + 1) - 
msg->buf;
+                       p = hdr->name.s + hdr->name.len + 1;

I see that code is assuming that `:` is immediately after header name. The 
specs for HTTP1.1 forbit space between header name and `:` 
(https://datatracker.ietf.org/doc/html/rfc7230, section 3.2.4), but I couldn't 
find quickly a clear statement about it. I am not really confident that I 
remember exactly, but I think I saw in the past cases where SIP UAs put spaces 
there.

So I am making a note here, maybe other can come with better references.

In general SER/Kamailio tried to be flexible in accepting "unclear" variants. 
Probably a safety check is to see if the existing sip header parser in the code 
is ok with whitespaces in that place.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/4586#pullrequestreview-3787355323
You are receiving this because you are subscribed to this thread.

Message ID: <kamailio/kamailio/pull/4586/review/[email protected]>
_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to