- don't crash on missing Contact header during registration
This commit is contained in:
parent
4d32a30a9f
commit
6e19514e23
@ -1,5 +1,6 @@
|
||||
0.5.8
|
||||
=====
|
||||
19-Aug-2004: - don't crash on missing Contact header during registration
|
||||
18-Aug-2004: - reworked configure.in for FLI4L building
|
||||
06-Jul-2004: - patch from Dan Weber: Open the password file for SIP
|
||||
accounts at startup, so we still have access after
|
||||
|
||||
@ -167,7 +167,7 @@ int register_client(sip_ticket_t *ticket, int force_lcl_masq) {
|
||||
int i, j, n, sts;
|
||||
int expires;
|
||||
time_t time_now;
|
||||
osip_uri_t *url1_to, *url1_contact;
|
||||
osip_uri_t *url1_to, *url1_contact=NULL;
|
||||
osip_uri_t *url2_to;
|
||||
osip_header_t *expires_hdr;
|
||||
osip_uri_param_t *expires_param=NULL;
|
||||
@ -223,9 +223,12 @@ int register_client(sip_ticket_t *ticket, int force_lcl_masq) {
|
||||
* look for an Contact expires parameter - in case of REGISTER
|
||||
* these two are equal. The Contact expires has higher priority!
|
||||
*/
|
||||
osip_contact_param_get_byname(
|
||||
(osip_contact_t*) ticket->sipmsg->contacts->node->element,
|
||||
EXPIRES, &expires_param);
|
||||
if (ticket->sipmsg->contacts && ticket->sipmsg->contacts->node &&
|
||||
ticket->sipmsg->contacts->node->element) {
|
||||
osip_contact_param_get_byname(
|
||||
(osip_contact_t*) ticket->sipmsg->contacts->node->element,
|
||||
EXPIRES, &expires_param);
|
||||
}
|
||||
|
||||
if (expires_param && expires_param->gvalue) {
|
||||
/* get expires from contact Header */
|
||||
@ -259,10 +262,13 @@ int register_client(sip_ticket_t *ticket, int force_lcl_masq) {
|
||||
* (gdb) p *((osip_contact_t*)(sip->contacts->node->element))
|
||||
* $5 = {displayname = 0x8af8848 "*", url = 0x0, gen_params = 0x8af8838}
|
||||
*/
|
||||
url1_contact=((osip_contact_t*)
|
||||
(ticket->sipmsg->contacts->node->element))->url;
|
||||
if (ticket->sipmsg->contacts && ticket->sipmsg->contacts->node &&
|
||||
ticket->sipmsg->contacts->node->element) {
|
||||
url1_contact=((osip_contact_t*)
|
||||
(ticket->sipmsg->contacts->node->element))->url;
|
||||
}
|
||||
if ((url1_contact == NULL) || (url1_contact->host == NULL)) {
|
||||
/* Don't have reqiured Contact fields */
|
||||
/* Don't have required Contact fields */
|
||||
ERROR("tried registration with empty Contact header");
|
||||
return STS_FAILURE;
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ int security_check_raw(char *sip_buffer, int size) {
|
||||
}
|
||||
|
||||
|
||||
/* As libosip2 is *VERY* sensitive to corrupt imput data, we need to
|
||||
/* As libosip2 is *VERY* sensitive to corrupt input data, we need to
|
||||
do more stuff here. For example, libosip2 can be crashed (with a
|
||||
"<port_malloc.c> virtual memory exhausted" error - God knows why)
|
||||
by sending the following few bytes. It will die in osip_message_parse()
|
||||
@ -82,7 +82,7 @@ int security_check_raw(char *sip_buffer, int size) {
|
||||
the 'only one space present' that leads to a faulty size
|
||||
calculation (VERY BIG NUMBER), which in turn then dies inside
|
||||
osip_malloc.
|
||||
So, we need at least 2 spaces to survive that coda part of libosip2.
|
||||
So, we need at least 2 spaces to survive that code part of libosip2.
|
||||
*/
|
||||
p1 = strchr(sip_buffer, ' ');
|
||||
if (p1 && ((p1+1) < (sip_buffer+size))) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user