Browse code

core: kemi - check hdr type HDR_ERROR_T after parsing

Daniel-Constantin Mierla authored on 02/06/2021 16:57:53
Showing 1 changed files
... ...
@@ -1988,7 +1988,8 @@ static int sr_kemi_hdr_append_after(sip_msg_t *msg, str *txt, str *hname)
1988 1988
 	hbuf[hname->len] = ':';
1989 1989
 	hbuf[hname->len+1] = '\0';
1990 1990
 
1991
-	if (parse_hname2_short(hbuf, hbuf+hname->len+1, &hfm)==0) {
1991
+	parse_hname2_short(hbuf, hbuf+hname->len+1, &hfm);
1992
+	if(hfm.type==HDR_ERROR_T) {
1992 1993
 		LM_ERR("error parsing header name [%.*s]\n", hname->len, hname->s);
1993 1994
 		return -1;
1994 1995
 	}
... ...
@@ -2056,7 +2057,8 @@ int sr_kemi_hdr_remove(sip_msg_t *msg, str *hname)
2056 2057
 	hbuf[hname->len] = ':';
2057 2058
 	hbuf[hname->len+1] = '\0';
2058 2059
 
2059
-	if (parse_hname2_short(hbuf, hbuf+hname->len+1, &hfm)==0) {
2060
+	parse_hname2_short(hbuf, hbuf+hname->len+1, &hfm);
2061
+	if(hfm.type==HDR_ERROR_T) {
2060 2062
 		LM_ERR("error parsing header name [%.*s]\n", hname->len, hname->s);
2061 2063
 		return -1;
2062 2064
 	}
... ...
@@ -2106,7 +2108,8 @@ static int sr_kemi_hdr_is_present(sip_msg_t *msg, str *hname)
2106 2108
 	hbuf[hname->len] = ':';
2107 2109
 	hbuf[hname->len+1] = '\0';
2108 2110
 
2109
-	if (parse_hname2_short(hbuf, hbuf+hname->len+1, &hfm)==0) {
2111
+	parse_hname2_short(hbuf, hbuf+hname->len+1, &hfm);
2112
+	if(hfm.type==HDR_ERROR_T) {
2110 2113
 		LM_ERR("error parsing header name [%.*s]\n", hname->len, hname->s);
2111 2114
 		return -1;
2112 2115
 	}
... ...
@@ -2188,7 +2191,8 @@ static int sr_kemi_hdr_insert_before(sip_msg_t *msg, str *txt, str *hname)
2188 2191
 	hbuf[hname->len] = ':';
2189 2192
 	hbuf[hname->len+1] = '\0';
2190 2193
 
2191
-	if (parse_hname2_short(hbuf, hbuf+hname->len+1, &hfm)==0) {
2194
+	parse_hname2_short(hbuf, hbuf+hname->len+1, &hfm);
2195
+	if(hfm.type==HDR_ERROR_T) {
2192 2196
 		LM_ERR("error parsing header name [%.*s]\n", hname->len, hname->s);
2193 2197
 		return -1;
2194 2198
 	}
... ...
@@ -2305,7 +2309,8 @@ static sr_kemi_xval_t* sr_kemi_hdr_get_mode(sip_msg_t *msg, str *hname, int idx,
2305 2309
 		sr_kemi_xval_null(&_sr_kemi_xval, rmode);
2306 2310
 		return &_sr_kemi_xval;
2307 2311
 	}
2308
-	if (parse_hname2_str(hname, &shdr)==0) {
2312
+	parse_hname2_str(hname, &shdr);
2313
+	if(shdr.type==HDR_ERROR_T) {
2309 2314
 		LM_ERR("error parsing header name [%.*s]\n", hname->len, hname->s);
2310 2315
 		sr_kemi_xval_null(&_sr_kemi_xval, rmode);
2311 2316
 		return &_sr_kemi_xval;
... ...
@@ -2426,7 +2431,8 @@ static int sr_kemi_hdr_match_content(sip_msg_t *msg, str *hname, str *op,
2426 2431
 		return SR_KEMI_FALSE;
2427 2432
 	}
2428 2433
 
2429
-	if (parse_hname2_str(hname, &hfm)==0) {
2434
+	parse_hname2_str(hname, &hfm);
2435
+	if(hfm.type==HDR_ERROR_T) {
2430 2436
 		LM_ERR("error parsing header name [%.*s]\n", hname->len, hname->s);
2431 2437
 		return SR_KEMI_FALSE;
2432 2438
 	}