Module: kamailio
Branch: master
Commit: 81c1ede698f8dd6f2147c71ee6f3bb49ed4a682c
URL:
https://github.com/kamailio/kamailio/commit/81c1ede698f8dd6f2147c71ee6f3bb4…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-08-23T10:54:02+02:00
core: allow space for ending string when creating socket structure at startup
---
Modified: src/core/socket_info.c
---
Diff:
https://github.com/kamailio/kamailio/commit/81c1ede698f8dd6f2147c71ee6f3bb4…
Patch:
https://github.com/kamailio/kamailio/commit/81c1ede698f8dd6f2147c71ee6f3bb4…
---
diff --git a/src/core/socket_info.c b/src/core/socket_info.c
index 04a2e609323..6786ecaf6cc 100644
--- a/src/core/socket_info.c
+++ b/src/core/socket_info.c
@@ -329,7 +329,7 @@ static inline struct socket_info *new_sock_info(char *name,
}
if(usename != NULL) {
si->useinfo.name.len = strlen(usename);
- si->useinfo.name.s = (char *)pkg_malloc(si->useinfo.name.len);
+ si->useinfo.name.s = (char *)pkg_malloc(si->useinfo.name.len + 1);
if(si->useinfo.name.s == 0)
goto error;
strncpy(si->useinfo.name.s, usename, si->useinfo.name.len + 1);