Module: sip-router
Branch: master
Commit: f1a09e44268c77641216a78878f2c73c6e5a4d66
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=f1a09e4…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Wed May 14 22:53:35 2014 +0200
pv: proper length for line transformation when handling last line of value
---
modules/pv/pv_trans.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/modules/pv/pv_trans.c b/modules/pv/pv_trans.c
index 868123e..0b2ccc0 100644
--- a/modules/pv/pv_trans.c
+++ b/modules/pv/pv_trans.c
@@ -126,13 +126,13 @@ static int urlencode_param(str *sin, str *sout)
{
char *at, *p;
- at = sout->s;
- p = sin->s;
-
if (sin==NULL || sout==NULL || sin->s==NULL || sout->s==NULL ||
sin->len<0 || sout->len < 3*sin->len+1)
return -1;
+ at = sout->s;
+ p = sin->s;
+
while (p < sin->s+sin->len) {
if (isalnum(*p) || *p == '-' || *p == '_' || *p == '.' || *p ==
'~')
*at++ = *p;
@@ -1655,7 +1655,7 @@ int tr_eval_line(struct sip_msg *msg, tr_param_t *tp, int subtype,
if(p==NULL)
{
/* last line */
- mv.len = (val->rs.s + val->rs.len) - p;
+ mv.len = (val->rs.s + val->rs.len) - mv.s;
} else {
mv.len = p - mv.s;
}
@@ -1737,7 +1737,7 @@ int tr_eval_line(struct sip_msg *msg, tr_param_t *tp, int subtype,
if(p==NULL)
{
/* last line */
- mv.len = (val->rs.s + val->rs.len) - p;
+ mv.len = (val->rs.s + val->rs.len) - mv.s;
} else {
mv.len = p - mv.s;
}