Module: kamailio
Branch: master
Commit: 28f4cab2878b441eb6ddbed03ae7ddbcdbae37e2
URL:
https://github.com/kamailio/kamailio/commit/28f4cab2878b441eb6ddbed03ae7ddb…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-04-29T09:43:53+02:00
dispatcher: use safer macros for temporarily making zero-ending strings
---
Modified: src/modules/dispatcher/dispatch.c
---
Diff:
https://github.com/kamailio/kamailio/commit/28f4cab2878b441eb6ddbed03ae7ddb…
Patch:
https://github.com/kamailio/kamailio/commit/28f4cab2878b441eb6ddbed03ae7ddb…
---
diff --git a/src/modules/dispatcher/dispatch.c b/src/modules/dispatcher/dispatch.c
index 004bb0cfae..589b54f5b8 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -420,23 +420,16 @@ ds_dest_t *pack_dest(str iuri, int flags, int priority, str *attrs)
} else if(dp->attrs.socket.s && dp->attrs.socket.len > 0) {
/* parse_phostport(...) expects 0-terminated string
* - after socket parameter is either ';' or '\0' */
- if(dp->attrs.socket.s[dp->attrs.socket.len] != '\0') {
- c = dp->attrs.socket.s[dp->attrs.socket.len];
- dp->attrs.socket.s[dp->attrs.socket.len] = '\0';
- }
+ STR_VTOZ(dp->attrs.socket.s[dp->attrs.socket.len], c);
if(parse_phostport(
dp->attrs.socket.s, &host.s, &host.len, &port, &proto)
!= 0) {
LM_ERR("bad socket <%.*s>\n", dp->attrs.socket.len,
dp->attrs.socket.s);
- if(c != 0) {
- dp->attrs.socket.s[dp->attrs.socket.len] = c;
- }
+ STR_ZTOV(dp->attrs.socket.s[dp->attrs.socket.len], c);
goto err;
}
- if(c != 0) {
- dp->attrs.socket.s[dp->attrs.socket.len] = c;
- }
+ STR_ZTOV(dp->attrs.socket.s[dp->attrs.socket.len], c);
dp->sock = grep_sock_info(&host, (unsigned short)port, proto);
if(dp->sock == 0) {
LM_ERR("non-local socket <%.*s>\n", dp->attrs.socket.len,