Module: sip-router
Branch: master
Commit: 79bfabdc2ae35a5b280c6a23ff611a005dac333c
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=79bfabd…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Tue Jan 28 18:43:13 2014 +0100
xhttp: check first the possition limits then access the data
- in the eval function for the transformation
- on a report generated by cppcheck sent by David Binderman
---
modules/xhttp/xhttp_trans.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/modules/xhttp/xhttp_trans.c b/modules/xhttp/xhttp_trans.c
index 36c5888..159b5f7 100644
--- a/modules/xhttp/xhttp_trans.c
+++ b/modules/xhttp/xhttp_trans.c
@@ -65,7 +65,7 @@ int xhttp_tr_eval_xhttpurl(struct sip_msg *msg, tr_param_t *tp, int
subtype,
_httpurl_str.len = val->rs.len;
memcpy(_httpurl_str.s, val->rs.s, val->rs.len);
- while (val->rs.s[pos] != '?' && pos < val->rs.len) pos++;
+ while (pos < val->rs.len && val->rs.s[pos] != '?') pos++;
_httpurl_querystring_pos = (pos >= val->rs.len) ? 0 : pos + 1;
}