Module: kamailio
Branch: master
Commit: 1677880999927b12bdbf62cb44ae61887d1585bc
URL:
https://github.com/kamailio/kamailio/commit/1677880999927b12bdbf62cb44ae618…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)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/1677880999927b12bdbf62cb44ae618…
Patch:
https://github.com/kamailio/kamailio/commit/1677880999927b12bdbf62cb44ae618…
---
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 */