[sr-dev] git:master:f9a38d6b: core: parser - catch special header types for get_hdr()

Daniel-Constantin Mierla miconda at gmail.com
Tue Mar 15 10:42:41 CET 2022


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-03-15T10:35:12+01:00

core: parser - catch special header types for get_hdr()

---

Modified: src/core/parser/msg_parser.c

---

Diff:  https://github.com/kamailio/kamailio/commit/f9a38d6b621a2c3966a3c85dce6fdd2e6bb8d431.diff
Patch: https://github.com/kamailio/kamailio/commit/f9a38d6b621a2c3966a3c85dce6fdd2e6bb8d431.patch

---

diff --git a/src/core/parser/msg_parser.c b/src/core/parser/msg_parser.c
index a348503544..6455c9e539 100644
--- a/src/core/parser/msg_parser.c
+++ b/src/core/parser/msg_parser.c
@@ -1012,10 +1012,14 @@ hdr_field_t* get_hdr(const sip_msg_t* const msg, const enum _hdr_types_t ht)
 {
 	hdr_field_t *hdr;
 
-	if (msg->parsed_flag & HDR_T2F(ht))
+	if (ht == HDR_ERROR_T || ht == HDR_EOH_T) {
+		return NULL;
+	}
+	if (msg->parsed_flag & HDR_T2F(ht)) {
 		for(hdr = msg->headers; hdr; hdr = hdr->next) {
 			if(hdr->type == ht) return hdr;
 		}
+	}
 	return NULL;
 }
 




More information about the sr-dev mailing list