|
@@ -542,11 +542,8 @@ int th_unmask_callid(sip_msg_t *msg)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-#define TH_CALLID_SIZE 256
|
|
|
|
-
|
|
|
|
int th_mask_callid_str(str *icallid, str *ocallid)
|
|
int th_mask_callid_str(str *icallid, str *ocallid)
|
|
{
|
|
{
|
|
- static char th_callid_mbuf[TH_CALLID_SIZE];
|
|
|
|
str out;
|
|
str out;
|
|
|
|
|
|
if(th_param_mask_callid==0)
|
|
if(th_param_mask_callid==0)
|
|
@@ -565,19 +562,9 @@ int th_mask_callid_str(str *icallid, str *ocallid)
|
|
LM_ERR("cannot encode call-id\n");
|
|
LM_ERR("cannot encode call-id\n");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
-
|
|
|
|
- if(out.len>=TH_CALLID_SIZE) {
|
|
|
|
- pkg_free(out.s);
|
|
|
|
- LM_ERR("not enough callid buf size (needed %d)\n", out.len);
|
|
|
|
- return -2;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- memcpy(th_callid_mbuf, out.s, out.len);
|
|
|
|
- th_callid_mbuf[out.len] = '\0';
|
|
|
|
-
|
|
|
|
- pkg_free(out.s);
|
|
|
|
-
|
|
|
|
- ocallid->s = th_callid_mbuf;
|
|
|
|
|
|
+
|
|
|
|
+ out.s[out.len] = '\0';
|
|
|
|
+ ocallid->s = out.s;
|
|
ocallid->len = out.len;
|
|
ocallid->len = out.len;
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
@@ -585,7 +572,7 @@ int th_mask_callid_str(str *icallid, str *ocallid)
|
|
|
|
|
|
int th_unmask_callid_str(str *icallid, str *ocallid)
|
|
int th_unmask_callid_str(str *icallid, str *ocallid)
|
|
{
|
|
{
|
|
- static char th_callid_buf[TH_CALLID_SIZE];
|
|
|
|
|
|
+
|
|
str out;
|
|
str out;
|
|
|
|
|
|
if(th_param_mask_callid==0)
|
|
if(th_param_mask_callid==0)
|
|
@@ -610,18 +597,9 @@ int th_unmask_callid_str(str *icallid, str *ocallid)
|
|
LM_ERR("failed to decode call-id\n");
|
|
LM_ERR("failed to decode call-id\n");
|
|
return -2;
|
|
return -2;
|
|
}
|
|
}
|
|
- if(out.len>=TH_CALLID_SIZE) {
|
|
|
|
- pkg_free(out.s);
|
|
|
|
- LM_ERR("not enough callid buf size (needed %d)\n", out.len);
|
|
|
|
- return -2;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- memcpy(th_callid_buf, out.s, out.len);
|
|
|
|
- th_callid_buf[out.len] = '\0';
|
|
|
|
-
|
|
|
|
- pkg_free(out.s);
|
|
|
|
-
|
|
|
|
- ocallid->s = th_callid_buf;
|
|
|
|
|
|
+
|
|
|
|
+ out.s[out.len] = '\0';
|
|
|
|
+ ocallid->s = out.s;
|
|
ocallid->len = out.len;
|
|
ocallid->len = out.len;
|
|
|
|
|
|
return 0;
|
|
return 0;
|