Module: kamailio Branch: master Commit: b5816caeacc4c597b5358c1dcd429581b3233667 URL: https://github.com/kamailio/kamailio/commit/b5816caeacc4c597b5358c1dcd429581...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2020-05-01T08:53:56+02:00
textopsx: use safer macros for temporarily making zero-ending strings
---
Modified: src/modules/textopsx/textopsx.c
---
Diff: https://github.com/kamailio/kamailio/commit/b5816caeacc4c597b5358c1dcd429581... Patch: https://github.com/kamailio/kamailio/commit/b5816caeacc4c597b5358c1dcd429581...
---
diff --git a/src/modules/textopsx/textopsx.c b/src/modules/textopsx/textopsx.c index 317abb6002..1452e1c3d1 100644 --- a/src/modules/textopsx/textopsx.c +++ b/src/modules/textopsx/textopsx.c @@ -352,11 +352,10 @@ static int keep_hf_helper(sip_msg_t *msg, regex_t *re) return -1; } } else { - c = hf->name.s[hf->name.len]; - hf->name.s[hf->name.len] = '\0'; + STR_VTOZ(hf->name.s[hf->name.len], c); if(regexec(re, hf->name.s, 1, &pmatch, 0) != 0) { /* no match => remove */ - hf->name.s[hf->name.len] = c; + STR_ZTOV(hf->name.s[hf->name.len], c); l = del_lump(msg, hf->name.s - msg->buf, hf->len, 0); if(l == 0) { LM_ERR("cannot remove header [%.*s]\n", hf->name.len, @@ -364,7 +363,7 @@ static int keep_hf_helper(sip_msg_t *msg, regex_t *re) return -1; } } else { - hf->name.s[hf->name.len] = c; + STR_ZTOV(hf->name.s[hf->name.len], c); } } }