[sr-dev] git:master:1d3fde12: core: parse via - safe check for end of buffer

Daniel-Constantin Mierla miconda at gmail.com
Tue Sep 14 08:36:49 CEST 2021


Module: kamailio
Branch: master
Commit: 1d3fde1205440296c1d6a54feee5a9d637055bee
URL: https://github.com/kamailio/kamailio/commit/1d3fde1205440296c1d6a54feee5a9d637055bee

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-09-14T08:05:05+02:00

core: parse via - safe check for end of buffer

- just in case it is needed to be used for non-zero-terminated strings

---

Modified: src/core/parser/parse_via.c

---

Diff:  https://github.com/kamailio/kamailio/commit/1d3fde1205440296c1d6a54feee5a9d637055bee.diff
Patch: https://github.com/kamailio/kamailio/commit/1d3fde1205440296c1d6a54feee5a9d637055bee.patch

---

diff --git a/src/core/parser/parse_via.c b/src/core/parser/parse_via.c
index 78bd304f32..100af6d6bf 100644
--- a/src/core/parser/parse_via.c
+++ b/src/core/parser/parse_via.c
@@ -940,7 +940,7 @@ static /*inline*/ char *parse_via_param(char *const p, const char *const end,
 
 find_value:
 	tmp++;
-	for(; *tmp; tmp++) {
+	for(; tmp<end && *tmp; tmp++) {
 		switch(*tmp) {
 			case ' ':
 			case '\t':
@@ -2064,7 +2064,7 @@ char *parse_via(
 	tmp++;
 	c_nest = 0;
 	/*state should always be F_HOST here*/;
-	for(; *tmp; tmp++) {
+	for(; tmp<end && *tmp; tmp++) {
 		switch(*tmp) {
 			case ' ':
 			case '\t':




More information about the sr-dev mailing list