Przeglądaj źródła

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.
AndreasHuber-CH 9 lat temu
rodzic
commit
c0697d76fc
1 zmienionych plików z 3 dodań i 3 usunięć
  1. 3 3
      modules/registrar/sip_msg.c

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