core: early detect of empty host for check_self()
authorDaniel-Constantin Mierla <miconda@gmail.com>
Wed, 17 Feb 2021 13:07:43 +0000 (14:07 +0100)
committerDaniel-Constantin Mierla <miconda@gmail.com>
Mon, 1 Mar 2021 17:30:47 +0000 (18:30 +0100)
(cherry picked from commit 6863cb8b0253c641146633bd063575a53bc6a466)

src/core/forward.c

index 716b148..a7f6c06 100644 (file)
@@ -408,6 +408,13 @@ int run_check_self_func(str* host, unsigned short port, unsigned short proto)
 int check_self(str* host, unsigned short port, unsigned short proto)
 {
        int ret = 1;
+
+       if(host==NULL || host->s==NULL || host->len<=0) {
+               /* no host (e.g., tel uri) - not matching myself */
+               LM_DBG("no host value - not matching myself addresses\n");
+               return 0;
+       }
+
        if (grep_sock_info(host, port, proto)) {
                goto done;
        }