Browse code

core: safety protection on handing incoming messages without setting local socket

Daniel-Constantin Mierla authored on 11/09/2019 07:36:14
Showing 1 changed files
... ...
@@ -221,7 +221,7 @@ int ksr_evrt_received(char *buf, unsigned int len, receive_info_t *rcv_info)
221 221
  *  WARNING: buf must be 0 terminated (buf[len]=0) or some things might
222 222
  * break (e.g.: modules/textops)
223 223
  */
224
-int receive_msg(char *buf, unsigned int len, struct receive_info *rcv_info)
224
+int receive_msg(char *buf, unsigned int len, receive_info_t *rcv_info)
225 225
 {
226 226
 	struct sip_msg *msg;
227 227
 	struct run_act_ctx ctx;
... ...
@@ -239,6 +239,12 @@ int receive_msg(char *buf, unsigned int len, struct receive_info *rcv_info)
239 239
 	int errsipmsg = 0;
240 240
 	int exectime = 0;
241 241
 
242
+	if(rcv_info->bind_address==NULL) {
243
+		LM_ERR("critical - incoming message without local socket [%.*s ...]\n",
244
+				(len>128)?128:len, buf);
245
+		return -1;
246
+	}
247
+
242 248
 	if(ksr_evrt_received_mode!=0) {
243 249
 		if(ksr_evrt_received(buf, len, rcv_info)<0) {
244 250
 			LM_DBG("dropping the received message\n");