[PATCH 1/2] rtl-obj.c: Added an early return if rtl lock fails

Ryan Long ryan.long at oarcorp.com
Mon Mar 22 17:08:28 UTC 2021


CID 1444138: Dereference null return value in rtems_rtl_obj_find_file().

Closes #4332
---
 cpukit/libdl/rtl-obj.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/cpukit/libdl/rtl-obj.c b/cpukit/libdl/rtl-obj.c
index a7dd740..d5a867e 100644
--- a/cpukit/libdl/rtl-obj.c
+++ b/cpukit/libdl/rtl-obj.c
@@ -409,6 +409,10 @@ rtems_rtl_obj_find_file (rtems_rtl_obj* obj, const char* name)
 
   rtl = rtems_rtl_lock ();
 
+  if (rtl == NULL) {
+    return false;
+  }
+
   if (!rtems_rtl_find_file (pname, rtl->paths, &obj->fname, &obj->fsize))
   {
     rtems_rtl_set_error (ENOENT, "file not found");
-- 
1.8.3.1



More information about the devel mailing list