[sr-dev] git:5.5:b5041e2c: core: kemi - check hdr type HDR_ERROR_T after parsing
Daniel-Constantin Mierla
miconda at gmail.com
Thu Jun 10 12:30:33 CEST 2021
Module: kamailio
Branch: 5.5
Commit: b5041e2c4a44843318fcd69d092342e2b29532f4
URL: https://github.com/kamailio/kamailio/commit/b5041e2c4a44843318fcd69d092342e2b29532f4
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-06-10T12:25:21+02:00
core: kemi - check hdr type HDR_ERROR_T after parsing
(cherry picked from commit 785bbaa0f16f83353ad1d776816f439608a67858)
---
Modified: src/core/kemi.c
---
Diff: https://github.com/kamailio/kamailio/commit/b5041e2c4a44843318fcd69d092342e2b29532f4.diff
Patch: https://github.com/kamailio/kamailio/commit/b5041e2c4a44843318fcd69d092342e2b29532f4.patch
---
diff --git a/src/core/kemi.c b/src/core/kemi.c
index 0932339996..64d23296dc 100644
--- a/src/core/kemi.c
+++ b/src/core/kemi.c
@@ -1988,7 +1988,8 @@ static int sr_kemi_hdr_append_after(sip_msg_t *msg, str *txt, str *hname)
hbuf[hname->len] = ':';
hbuf[hname->len+1] = '\0';
- if (parse_hname2_short(hbuf, hbuf+hname->len+1, &hfm)==0) {
+ parse_hname2_short(hbuf, hbuf+hname->len+1, &hfm);
+ if(hfm.type==HDR_ERROR_T) {
LM_ERR("error parsing header name [%.*s]\n", hname->len, hname->s);
return -1;
}
@@ -2056,7 +2057,8 @@ int sr_kemi_hdr_remove(sip_msg_t *msg, str *hname)
hbuf[hname->len] = ':';
hbuf[hname->len+1] = '\0';
- if (parse_hname2_short(hbuf, hbuf+hname->len+1, &hfm)==0) {
+ parse_hname2_short(hbuf, hbuf+hname->len+1, &hfm);
+ if(hfm.type==HDR_ERROR_T) {
LM_ERR("error parsing header name [%.*s]\n", hname->len, hname->s);
return -1;
}
@@ -2106,7 +2108,8 @@ static int sr_kemi_hdr_is_present(sip_msg_t *msg, str *hname)
hbuf[hname->len] = ':';
hbuf[hname->len+1] = '\0';
- if (parse_hname2_short(hbuf, hbuf+hname->len+1, &hfm)==0) {
+ parse_hname2_short(hbuf, hbuf+hname->len+1, &hfm);
+ if(hfm.type==HDR_ERROR_T) {
LM_ERR("error parsing header name [%.*s]\n", hname->len, hname->s);
return -1;
}
@@ -2188,7 +2191,8 @@ static int sr_kemi_hdr_insert_before(sip_msg_t *msg, str *txt, str *hname)
hbuf[hname->len] = ':';
hbuf[hname->len+1] = '\0';
- if (parse_hname2_short(hbuf, hbuf+hname->len+1, &hfm)==0) {
+ parse_hname2_short(hbuf, hbuf+hname->len+1, &hfm);
+ if(hfm.type==HDR_ERROR_T) {
LM_ERR("error parsing header name [%.*s]\n", hname->len, hname->s);
return -1;
}
@@ -2305,7 +2309,8 @@ static sr_kemi_xval_t* sr_kemi_hdr_get_mode(sip_msg_t *msg, str *hname, int idx,
sr_kemi_xval_null(&_sr_kemi_xval, rmode);
return &_sr_kemi_xval;
}
- if (parse_hname2_str(hname, &shdr)==0) {
+ parse_hname2_str(hname, &shdr);
+ if(shdr.type==HDR_ERROR_T) {
LM_ERR("error parsing header name [%.*s]\n", hname->len, hname->s);
sr_kemi_xval_null(&_sr_kemi_xval, rmode);
return &_sr_kemi_xval;
@@ -2426,7 +2431,8 @@ static int sr_kemi_hdr_match_content(sip_msg_t *msg, str *hname, str *op,
return SR_KEMI_FALSE;
}
- if (parse_hname2_str(hname, &hfm)==0) {
+ parse_hname2_str(hname, &hfm);
+ if(hfm.type==HDR_ERROR_T) {
LM_ERR("error parsing header name [%.*s]\n", hname->len, hname->s);
return SR_KEMI_FALSE;
}
More information about the sr-dev
mailing list