Discussion:
[sr-dev] git:master:a4d94268: textops: find_hdr_line_start() - locate header name without error logs
Daniel-Constantin Mierla
2021-06-02 16:07:57 UTC
Permalink
Content preview: Module: kamailio Branch: master Commit: a4d94268c7cf5d31e3660b543b10ef6e7ca891ab
URL: https://github.com/kamailio/kamailio/commit/a4d94268c7cf5d31e3660b543b10ef6e7ca891ab
Author: Daniel-Constantin Mierla <***@gmail.com> Committer: Daniel-Constantin
Mierla <***@gmail.com> Date: 2021-06-02T18:02:24+02:00

Content analysis details: (-2.4 points, 5.5 required)

pts rule name description
---- ---------------------- --------------------------------------------------
-1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP
-1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
[score: 0.0000]
0.0 DKIM_ADSP_CUSTOM_MED No valid author signature, adsp_override is
CUSTOM_MED
0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
provider (miconda[at]gmail.com)
0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level
mail domains are different
1.0 FORGED_GMAIL_RCVD 'From' gmail.com does not match 'Received'
headers
0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and
EnvelopeFrom freemail headers are
different
-1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list
manager

Module: kamailio
Branch: master
Commit: a4d94268c7cf5d31e3660b543b10ef6e7ca891ab
URL: https://github.com/kamailio/kamailio/commit/a4d94268c7cf5d31e3660b543b10ef6e7ca891ab

Author: Daniel-Constantin Mierla <***@gmail.com>
Committer: Daniel-Constantin Mierla <***@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/a4d94268c7cf5d31e3660b543b10ef6e7ca891ab.diff
Patch: https://github.com/kamailio/kamailio/commit/a4d94268c7cf5d31e3660b543b10ef6e7ca891ab.patch

---

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");

Loading...