Module: kamailio
Branch: master
Commit: a4d94268c7cf5d31e3660b543b10ef6e7ca891ab
URL:
https://github.com/kamailio/kamailio/commit/a4d94268c7cf5d31e3660b543b10ef6…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-06-02T18:02:24+02:00
textops: find_hdr_line_start() - locate header name without error logs
---
Modified: src/modules/textops/textops.c
---
Diff:
https://github.com/kamailio/kamailio/commit/a4d94268c7cf5d31e3660b543b10ef6…
Patch:
https://github.com/kamailio/kamailio/commit/a4d94268c7cf5d31e3660b543b10ef6…
---
diff --git a/src/modules/textops/textops.c b/src/modules/textops/textops.c
index cbc2309cfe..40ea02c273 100644
--- a/src/modules/textops/textops.c
+++ b/src/modules/textops/textops.c
@@ -1611,13 +1611,16 @@ static inline int find_hdr_line_start(char *hname, unsigned int
hname_len,
start = *buf;
len = *buf_len;
- if(parse_hname2_str(&sname, &h1)==NULL) {
+ parse_hname2_str(&sname, &h1);
+ if(h1.type!=HDR_ERROR_T) {
LM_ERR("not a header name: %.*s\n", hname_len, hname);
return 0;
}
while (hname_len <= len) {
- if(parse_hname2(start, start + hname_len, &h2)!=NULL) {
+ /* attempt to find a header name */
+ parse_sip_header_name(start, start + hname_len, &h2, 1, 0);
+ if(h2.type!=HDR_ERROR_T) {
if(h1.type>0 && h1.type==h2.type) {
*buf = start;
*buf_len = len;
@@ -1628,6 +1631,7 @@ static inline int find_hdr_line_start(char *hname, unsigned int
hname_len,
return 1;
}
}
+ /* jump to next line */
if ((ch = memchr(start, 13, len - 1))) {
if (*(ch + 1) != 10) {
LM_ERR("No LF after CR\n");