[libbsd master] rtemsbsd/rc_conf: Fixed non-nullterminated string causing crashes
aaron.nyholm at unfoldedeffective.com
aaron.nyholm at unfoldedeffective.com
Fri Mar 17 04:18:28 UTC 2023
From: Aaron Nyholm <aaron.nyholm at southerninnovation.com>
---
rtemsbsd/rtems/rtems-bsd-rc-conf.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/rtemsbsd/rtems/rtems-bsd-rc-conf.c b/rtemsbsd/rtems/rtems-bsd-rc-conf.c
index d559c256..f4cc987b 100644
--- a/rtemsbsd/rtems/rtems-bsd-rc-conf.c
+++ b/rtemsbsd/rtems/rtems-bsd-rc-conf.c
@@ -869,7 +869,7 @@ rtems_bsd_run_rc_conf(const char* name, int timeout, bool verbose)
if (r < 0)
return r;
- rc_conf = malloc(sb.st_size);
+ rc_conf = malloc(sb.st_size + 1);
if (rc_conf == NULL) {
errno = ENOMEM;
return -1;
@@ -892,6 +892,8 @@ rtems_bsd_run_rc_conf(const char* name, int timeout, bool verbose)
fclose(file);
+ rc_conf[sb.st_size] = '\0';
+
r = rtems_bsd_run_rc_conf_script(name, rc_conf, timeout, verbose);
free(rc_conf);
--
2.25.1
More information about the devel
mailing list