Module: kamailio
Branch: master
Commit: 85456e17df760b3d716aa1207a59ef0c3a29b4b4
URL: 
https://github.com/kamailio/kamailio/commit/85456e17df760b3d716aa1207a59ef0c3a29b4b4

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2024-11-13T14:58:57+01:00

topoh: check if socket name is set for building sockets strings

---

Modified: src/modules/topoh/topoh_mod.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/85456e17df760b3d716aa1207a59ef0c3a29b4b4.diff
Patch: 
https://github.com/kamailio/kamailio/commit/85456e17df760b3d716aa1207a59ef0c3a29b4b4.patch

---

diff --git a/src/modules/topoh/topoh_mod.c b/src/modules/topoh/topoh_mod.c
index 7dffa829504..450b0c7d93a 100644
--- a/src/modules/topoh/topoh_mod.c
+++ b/src/modules/topoh/topoh_mod.c
@@ -316,10 +316,19 @@ int th_build_socket_strings(socket_info_t *socket)
        struct str_hash_entry *table_entry = NULL;
        str *socket_ip = NULL;
 
+       if(socket->sockname.s == NULL || socket->sockname.len <= 0) {
+               LM_ERR("the socket [%.*s] has no name - it must be set\n",
+                               socket->address_str.len, socket->address_str.s);
+               return -1;
+       }
+
        if(str_hash_get(
                           th_socket_hash_table, socket->sockname.s, 
socket->sockname.len)
-                       != 0)
+                       != 0) {
+               LM_DBG("entry found for socket name [%.*s]\n", 
socket->sockname.len,
+                               socket->sockname.s);
                return 0;
+       }
 
        socket_strings = pkg_mallocxz(sizeof(struct th_socket_strings));
        if(socket_strings == NULL) {

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org

Reply via email to