diff --git a/etc/kamailio.cfg b/etc/kamailio.cfg index da204e8224..5cde0a6ea2 100644 --- a/etc/kamailio.cfg +++ b/etc/kamailio.cfg @@ -168,6 +168,10 @@ import_file "kamailio-local.cfg" #!define FLB_NATB 6 #!define FLB_NATSIPPING 7 +# - values +#!trydef MSG_MAX_SIZE 16384 +#!trydef RURI_MAX_SIZE 512 + ####### Global Parameters ######### /* LOG Levels: 3=DBG, 2=INFO, 1=NOTICE, 0=WARN, -1=ERR, ... */ @@ -670,6 +674,14 @@ route[REQINIT] { # sl_send_reply("200", "OK"); exit; } + if($msg(len) > MSG_MAX_SIZE) { + sl_send_reply("403", "Message too large"); + exit; + } + if($(ru{s.len}) > RURI_MAX_SIZE) { + sl_send_reply("403", "R-URI too large"); + exit; + } if (!mf_process_maxfwd_header("10")) { sl_send_reply("483", "Too Many Hops"); @@ -1065,6 +1077,10 @@ reply_route { xlog("Malformed SIP response from $si:$sp\n"); drop; } + if($msg(len) > MSG_MAX_SIZE) { + drop; + } + return; }