- fixed some senseless range checks on "Max-Forward"

and "Expires" headers (Thank you Alex for telling me)
This commit is contained in:
Thomas Ries
2009-01-07 20:37:11 +00:00
parent f2dd8d7b29
commit bc6bc5169b
4 changed files with 10 additions and 8 deletions

View File

@@ -1,5 +1,7 @@
0.7.2
=====
07-Jan-2009: - fixed some senseless range checks on "Max-Forward"
and "Expires" headers (Thank you Alex for telling me)
08-Nov-2008: - check & define if SOL_IP not existing (some *BSDs)
- honor PTHREAD_LDFLAGS from environment
01-Aug-2008: - SIP DSCP value configurable

View File

@@ -266,8 +266,8 @@ sts=sip_obscure_callid(ticket);
} else {
if (max_forwards->hvalue) {
forwards_count = atoi(max_forwards->hvalue);
if ((forwards_count<=0)||
(forwards_count>=LONG_MAX)) forwards_count=DEFAULT_MAXFWD;
if ((forwards_count<0)||
(forwards_count>255)) forwards_count=DEFAULT_MAXFWD;
forwards_count -=1;
osip_free (max_forwards->hvalue);
}

View File

@@ -293,12 +293,12 @@ int register_client(sip_ticket_t *ticket, int force_lcl_masq) {
if (expires_param && expires_param->gvalue) {
/* get expires from contact Header */
expires=atoi(expires_param->gvalue);
if ((expires < 0) || (expires >= LONG_MAX))
if ((expires < 0) || (expires >= ((2**32)-1) ))
expires=configuration.default_expires;
} else if (expires_hdr && expires_hdr->hvalue) {
/* get expires from expires Header */
expires=atoi(expires_hdr->hvalue);
if ((expires < 0) || (expires >= LONG_MAX))
if ((expires < 0) || (expires >= ((2**32)-1) ))
expires=configuration.default_expires;
} else {
char tmp[16];
@@ -665,12 +665,12 @@ int register_set_expire(sip_ticket_t *ticket) {
if (expires_param && expires_param->gvalue) {
/* get expires from contact Header */
expires=atoi(expires_param->gvalue);
if ((expires < 0) || (expires >= LONG_MAX))
if ((expires < 0) || (expires >= ((2**32)-1) ))
expires=configuration.default_expires;
} else if (expires_hdr && expires_hdr->hvalue) {
/* get expires from expires Header */
expires=atoi(expires_hdr->hvalue);
if ((expires < 0) || (expires >= LONG_MAX))
if ((expires < 0) || (expires >= ((2**32)-1) ))
expires=configuration.default_expires;
}

View File

@@ -455,8 +455,8 @@ int main (int argc, char *argv[])
osip_message_get_max_forwards(ticket.sipmsg, 0, &max_forwards);
if (max_forwards && max_forwards->hvalue) {
forwards_count = atoi(max_forwards->hvalue);
if ((forwards_count<=0)||
(forwards_count>=LONG_MAX)) forwards_count=DEFAULT_MAXFWD;
if ((forwards_count<0)||
(forwards_count>255)) forwards_count=DEFAULT_MAXFWD;
}
DEBUGC(DBCLASS_PROXY,"checking Max-Forwards (=%i)",forwards_count);