[sr-dev] git:master:15f57cea: core: main - set ending 0 in allocated cfg file path

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


Module: kamailio
Branch: master
Commit: 15f57ceae26b967ad92dd3a97ebcd869d1197244
URL: https://github.com/kamailio/kamailio/commit/15f57ceae26b967ad92dd3a97ebcd869d1197244

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

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

---

Modified: src/main.c

---

Diff:  https://github.com/kamailio/kamailio/commit/15f57ceae26b967ad92dd3a97ebcd869d1197244.diff
Patch: https://github.com/kamailio/kamailio/commit/15f57ceae26b967ad92dd3a97ebcd869d1197244.patch

---

diff --git a/src/main.c b/src/main.c
index 405b442158..71a024d5bb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1288,7 +1288,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