diff --git a/ChangeLog b/ChangeLog index e62f1e8..42fecbf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 0.5.5 ===== + 5-Apr-2004: - config file: don't complain on line s with only whitespaces + - fix: Via branch calculation + - security.c: increased max acceptable line length + - security.c: prevent libosip2 to die with "out of memory" + on some malformed headers 4-Apr-2004: - Realtime Scheduling for RTP proxy 3-Apr-2004: - fix: SDP 'c=' items in media part 2-Apr-2004: - PID file diff --git a/config.h.in b/config.h.in index 062f8e5..f572e93 100644 --- a/config.h.in +++ b/config.h.in @@ -72,12 +72,6 @@ /* Define to 1 if you have the `osipparser2' library (-losipparser2). */ #undef HAVE_LIBOSIPPARSER2 -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_IP_MASQ_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_NETFILTER_H - /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H diff --git a/configure.in b/configure.in index da25ec6..73246a7 100644 --- a/configure.in +++ b/configure.in @@ -120,8 +120,6 @@ case "$target" in *-*-linux*) AC_MSG_RESULT(Linux) AC_DEFINE(_LINUX,,[building on Linux platform]) - AC_CHECK_HEADERS(linux/ip_masq.h) - AC_CHECK_HEADERS(linux/netfilter.h) ;; *-*-freebsd*) AC_MSG_RESULT(FreeBSD) diff --git a/src/readconf.c b/src/readconf.c index b81bce7..f120064 100644 --- a/src/readconf.c +++ b/src/readconf.c @@ -181,12 +181,12 @@ static int parse_config (FILE *configfile) { /* strip newline if present */ if (buff[strlen(buff)-1]=='\n') buff[strlen(buff)-1]='\0'; - /* strip emty lines */ + /* strip emtpy lines */ if (strlen(buff) == 0) continue; /* strip comments and line with only whitespaces */ for (i=0;i virtual memory exhausted" error - God knows why) + by sending the following few bytes. It will die in osip_message_parse() + ---BUFFER DUMP follows--- + 6e 74 2f 38 30 30 30 0d 0a 61 3d 66 6d 74 70 3a nt/8000..a=fmtp: + 31 30 31 20 30 2d 31 35 0d 0a 101 0-15.. + ---end of BUFFER DUMP--- + + By looking at the code in osip_message_parse.c, I'd guess it is + 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. + */ + p1 = strchr(sip_buffer, ' '); + if (p1 && ((p1+1) < (sip_buffer+size))) { + p2 = strchr(p1+1, ' '); + } else { + DEBUGC(DBCLASS_SIP,"security_check_raw: found no space"); + return STS_FAILURE; + } + if (p2==NULL) { + DEBUGC(DBCLASS_SIP,"security_check_raw: found only one space"); + return STS_FAILURE; + } + /* TODO: still way to go here ... */ return STS_SUCCESS; diff --git a/src/sip_utils.c b/src/sip_utils.c index 2100395..b60a981 100644 --- a/src/sip_utils.c +++ b/src/sip_utils.c @@ -773,8 +773,9 @@ int sip_calculate_branch_id (osip_message_t *sip_msg, char *id) { param=NULL; osip_via_param_get_byname(via, "branch", ¶m); if (param && param->gvalue) { + DEBUGC(DBCLASS_BABBLE, "looking for magic cookie [%s]",param->gvalue); if (strncmp(param->gvalue, magic_cookie, - strlen(magic_cookie))) { + strlen(magic_cookie))==0) { /* calculate MD5 hash */ MD5_CTX Md5Ctx; HASH HA1; diff --git a/src/siproxd.h b/src/siproxd.h index 7df7866..f3a6098 100644 --- a/src/siproxd.h +++ b/src/siproxd.h @@ -186,8 +186,10 @@ struct siproxd_config { /* constants for security testing */ #define SEC_MINLEN 16 /* minimum received length */ -#define SEC_MAXLINELEN 256 /* maximum acceptable length of one line - in the SIP telegram (security check) */ +#define SEC_MAXLINELEN 1024 /* maximum acceptable length of one line + in the SIP telegram (security check) + Careful: Proxy-Authorization lines may + get quite long */ /* symbols for access control */ #define ACCESSCTL_SIP 1 /* for access control - SIP allowed */ diff --git a/tools/extract_sip.pl b/tools/extract_sip.pl index 094ef8d..ce7e46f 100755 --- a/tools/extract_sip.pl +++ b/tools/extract_sip.pl @@ -21,6 +21,6 @@ while (<>) { for (my $i=0; $i<16; $i++) { # write HEX byte as character - print chr(hex($hex[$i])); + if (hex($hex[$i]) != "") {print chr(hex($hex[$i]));} } }