Module: kamailio
Branch: master
Commit: 1677880999927b12bdbf62cb44ae61887d1585bc
URL: 
https://github.com/kamailio/kamailio/commit/1677880999927b12bdbf62cb44ae61887d1585bc

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2023-11-13T09:19:18+01:00

core: init socket mcast using pkg_mallocxz()

---

Modified: src/core/socket_info.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/1677880999927b12bdbf62cb44ae61887d1585bc.diff
Patch: 
https://github.com/kamailio/kamailio/commit/1677880999927b12bdbf62cb44ae61887d1585bc.patch

---

diff --git a/src/core/socket_info.c b/src/core/socket_info.c
index 230eab02ff5..caad839ee8f 100644
--- a/src/core/socket_info.c
+++ b/src/core/socket_info.c
@@ -1090,14 +1090,15 @@ static struct socket_info *new_sock2list(char *name, 
struct name_lst *addr_l,
 #ifdef USE_MCAST
        if(mcast != 0) {
                si->mcast.len = strlen(mcast);
-               si->mcast.s = (char *)pkg_malloc(si->mcast.len + 1);
+               si->mcast.s = (char *)pkg_mallocxz(si->mcast.len + 1);
                if(si->mcast.s == 0) {
                        PKG_MEM_ERROR;
+                       si->mcast.len = 0;
                        pkg_free(si->name.s);
                        pkg_free(si);
                        return 0;
                }
-               strcpy(si->mcast.s, mcast);
+               memcpy(si->mcast.s, mcast, si->mcast.len);
                mcast = 0;
        }
 #endif /* USE_MCAST */

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

Reply via email to