Sfoglia il codice sorgente

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
Daniel-Constantin Mierla 11 anni fa
parent
commit
79bfabdc2a
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      modules/xhttp/xhttp_trans.c

+ 1 - 1
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;
 	}