From b5816caeacc4c597b5358c1dcd429581b3233667 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Fri, 1 May 2020 08:53:56 +0200 Subject: [PATCH] textopsx: use safer macros for temporarily making zero-ending strings --- src/modules/textopsx/textopsx.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/modules/textopsx/textopsx.c b/src/modules/textopsx/textopsx.c index 317abb60028..1452e1c3d14 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); } } }