[PATCH rtems-libbsd 6-freebsd-12 1/5] rtemsbsd/rc-conf: Avoid use after free

Kinsey Moore kinsey.moore at oarcorp.com
Tue Jan 23 21:54:52 UTC 2024


---
 rtemsbsd/rtems/rtems-bsd-rc-conf.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/rtemsbsd/rtems/rtems-bsd-rc-conf.c b/rtemsbsd/rtems/rtems-bsd-rc-conf.c
index f4cc987b..d34aafd9 100644
--- a/rtemsbsd/rtems/rtems-bsd-rc-conf.c
+++ b/rtemsbsd/rtems/rtems-bsd-rc-conf.c
@@ -714,6 +714,7 @@ rc_conf_worker(rtems_task_argument task_argument)
   rtems_chain_node*  node = rtems_chain_first(&services);
   int                r = 0;
   int                error;
+  bool               rc_conf_verbose;
 
   /*
    * Check for a syslog priority before any services are run.
@@ -748,6 +749,8 @@ rc_conf_worker(rtems_task_argument task_argument)
   if (r < 0)
     rc_conf->error_code = error;
 
+  rc_conf_verbose = rc_conf->verbose;
+
   /*
    * If there is a waiter signal else clean up because the waiter has gone.
    */
@@ -760,7 +763,7 @@ rc_conf_worker(rtems_task_argument task_argument)
     rc_conf_destroy(rc_conf);
   }
 
-  if (rc_conf->verbose)
+  if (rc_conf_verbose)
     printf("rc.conf: finished\n");
 
   rtems_task_exit();
-- 
2.39.2



More information about the devel mailing list