Module: kamailio Branch: master Commit: 9d8f6e25e30a48e6a1c55cfa112317b3da42207a URL: https://github.com/kamailio/kamailio/commit/9d8f6e25e30a48e6a1c55cfa112317b3...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2019-09-11T09:37:00+02:00
core: safety protection on handing incoming messages without setting local socket
---
Modified: src/core/receive.c
---
Diff: https://github.com/kamailio/kamailio/commit/9d8f6e25e30a48e6a1c55cfa112317b3... Patch: https://github.com/kamailio/kamailio/commit/9d8f6e25e30a48e6a1c55cfa112317b3...
---
diff --git a/src/core/receive.c b/src/core/receive.c index 33dd7f17eb..b780440030 100644 --- a/src/core/receive.c +++ b/src/core/receive.c @@ -221,7 +221,7 @@ int ksr_evrt_received(char *buf, unsigned int len, receive_info_t *rcv_info) * WARNING: buf must be 0 terminated (buf[len]=0) or some things might * break (e.g.: modules/textops) */ -int receive_msg(char *buf, unsigned int len, struct receive_info *rcv_info) +int receive_msg(char *buf, unsigned int len, receive_info_t *rcv_info) { struct sip_msg *msg; struct run_act_ctx ctx; @@ -239,6 +239,12 @@ int receive_msg(char *buf, unsigned int len, struct receive_info *rcv_info) int errsipmsg = 0; int exectime = 0;
+ if(rcv_info->bind_address==NULL) { + LM_ERR("critical - incoming message without local socket [%.*s ...]\n", + (len>128)?128:len, buf); + return -1; + } + if(ksr_evrt_received_mode!=0) { if(ksr_evrt_received(buf, len, rcv_info)<0) { LM_DBG("dropping the received message\n");