[sr-dev] git:5.2:9c3fd4b2: Revert "xcap_server: check before going to the end of the buffer"

Henning Westerholt hw at skalatan.de
Fri Oct 2 20:33:12 CEST 2020


Module: kamailio
Branch: 5.2
Commit: 9c3fd4b20254302b174331acec560f809d305e44
URL: https://github.com/kamailio/kamailio/commit/9c3fd4b20254302b174331acec560f809d305e44

Author: Henning Westerholt <hw at skalatan.de>
Committer: Henning Westerholt <hw at skalatan.de>
Date: 2020-10-02T18:32:39Z

Revert "xcap_server: check before going to the end of the buffer"

This reverts commit f82bdb7fadd02368133b4813cdba515a7725a31d.

---

Modified: src/modules/xcap_server/xcap_server.c

---

Diff:  https://github.com/kamailio/kamailio/commit/9c3fd4b20254302b174331acec560f809d305e44.diff
Patch: https://github.com/kamailio/kamailio/commit/9c3fd4b20254302b174331acec560f809d305e44.patch

---

diff --git a/src/modules/xcap_server/xcap_server.c b/src/modules/xcap_server/xcap_server.c
index 3068356925..7405071b21 100644
--- a/src/modules/xcap_server/xcap_server.c
+++ b/src/modules/xcap_server/xcap_server.c
@@ -319,12 +319,14 @@ int xcaps_xpath_hack(str *buf, int type)
 	}
 
 	start = buf->s;
-	STR_VTOZ(buf->s[buf->len-1], c);
-	while((start < buf->s + buf->len - 8) && (p = strstr(start, match))!=NULL) {
+	c = buf->s[buf->len-1];
+	buf->s[buf->len-1] = '\0';
+	while((p = strstr(start, match))!=NULL)
+	{
 		memcpy(p, repl, 7);
 		start = p + 7;
 	}
-	STR_ZTOV(buf->s[buf->len-1], c);
+	buf->s[buf->len-1] = c;
 	return 0;
 }
 




More information about the sr-dev mailing list