[sr-dev] git:5.4:38d72250: core: main - set ending 0 in allocated cfg file path

Daniel-Constantin Mierla miconda at gmail.com
Thu Apr 15 10:29:54 CEST 2021


Module: kamailio
Branch: 5.4
Commit: 38d72250f4c9c77bee71262b6c340503cc9a92a2
URL: https://github.com/kamailio/kamailio/commit/38d72250f4c9c77bee71262b6c340503cc9a92a2

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-04-15T10:29:43+02:00

core: main - set ending 0 in allocated cfg file path

(cherry picked from commit 15f57ceae26b967ad92dd3a97ebcd869d1197244)

---

Modified: src/main.c

---

Diff:  https://github.com/kamailio/kamailio/commit/38d72250f4c9c77bee71262b6c340503cc9a92a2.diff
Patch: https://github.com/kamailio/kamailio/commit/38d72250f4c9c77bee71262b6c340503cc9a92a2.patch

---

diff --git a/src/main.c b/src/main.c
index ad83cff3a8..3a67f841e6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1281,7 +1281,7 @@ int fix_cfg_file(void)
 		}
 		if ((res = malloc(cfg_len + 1)) == NULL) goto error;
 		memcpy(res, cfg_file, cfg_len);
-		cfg_file[cfg_len] = 0;
+		res[cfg_len] = 0;
 		cfg_file = res;
 		return 0;
 	}




More information about the sr-dev mailing list