[sr-dev] git:master:c0697d76: registrar: Check max URI size of contact also for first contact header

AndreasHuber-CH andreas.huber at nagra.com
Wed Jul 27 23:35:25 CEST 2016


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

Author: AndreasHuber-CH <andreas.huber at nagra.com>
Committer: AndreasHuber-CH <andreas.huber at nagra.com>
Date: 2016-07-26T09:00:35+02:00

registrar: Check max URI size of contact also for first contact header

The URI size of contacts is checked against a max size to ensure that it fits into the database column.
This check was already present before but was done only for the contact header fields other than the first header field
which made that REGISTER with a single contact were not checked for max size and were truncated later when stored to the database.
With this fix all contact URIs of all contact header fields are checked against the max size.

---

Modified: modules/registrar/sip_msg.c

---

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

---

diff --git a/modules/registrar/sip_msg.c b/modules/registrar/sip_msg.c
index 8856ce4..dd4ccce 100644
--- a/modules/registrar/sip_msg.c
+++ b/modules/registrar/sip_msg.c
@@ -179,10 +179,10 @@ int check_contacts(struct sip_msg* _m, int* _s)
 
 		*_s = 1;
 	} else { /* The first Contact HF is not star */
-		/* Message must contain no star Contact HF */
-		p = _m->contact->next;
+		p = _m->contact;
 		while(p) {
 			if (p->type == HDR_CONTACT_T) {
+				/* Message must contain no star Contact HF */
 				if (((contact_body_t*)p->parsed)->star == 1) {
 					LM_WARN("star contact cannot be mixed with other contacts\n");
 					rerrno = R_STAR_CONT;
@@ -193,7 +193,7 @@ int check_contacts(struct sip_msg* _m, int* _s)
 					if (c->uri.len > CONTACT_MAX_SIZE) {
 						LM_WARN("contact uri is too long: [%.*s]\n", c->uri.len, c->uri.s);
 						rerrno = R_CONTACT_LEN;
-						return 1;						
+						return 1;
 					}
 					if (c->received && c->received->len>RECEIVED_MAX_SIZE) {
 						LM_WARN("received attribute of contact is too long\n");




More information about the sr-dev mailing list