[sr-dev] git:master:6997738a: sst: add 0 after memcpy

Daniel-Constantin Mierla miconda at gmail.com
Mon Jul 24 08:27:49 CEST 2017


Module: kamailio
Branch: master
Commit: 6997738a7098ef56becfd40cb6e7c7864d1975f0
URL: https://github.com/kamailio/kamailio/commit/6997738a7098ef56becfd40cb6e7c7864d1975f0

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-07-24T08:26:38+02:00

sst: add 0 after memcpy

---

Modified: src/modules/sst/sst_handlers.c

---

Diff:  https://github.com/kamailio/kamailio/commit/6997738a7098ef56becfd40cb6e7c7864d1975f0.diff
Patch: https://github.com/kamailio/kamailio/commit/6997738a7098ef56becfd40cb6e7c7864d1975f0.patch

---

diff --git a/src/modules/sst/sst_handlers.c b/src/modules/sst/sst_handlers.c
index ba1d4928b0..be55eb8883 100644
--- a/src/modules/sst/sst_handlers.c
+++ b/src/modules/sst/sst_handlers.c
@@ -791,11 +791,12 @@ static int append_header(struct sip_msg *msg, const char *header)
 		return(1);
 	}
 	len = strlen(header);
-	if ((s = (char *)pkg_malloc(len)) == 0) {
+	if ((s = (char *)pkg_malloc(len+1)) == 0) {
 		LM_ERR("No more pkg memory. (size requested = %d)\n", len);
 		return(1);
 	}
 	memcpy(s, header, len);
+	s[len] = '\0';
 	if (insert_new_lump_before(anchor, s, len, 0) == 0) {
 		LM_ERR("failed to insert lump\n");
 		pkg_free(s);




More information about the sr-dev mailing list