[rtems commit] cpukit/libdl: Fix incorrect operator precedence access the name

Chris Johns chrisj at rtems.org
Tue Aug 29 01:21:55 UTC 2023


Module:    rtems
Branch:    master
Commit:    ceb136c7b64b388d293061f064d7b8ccdfd9c9ba
Changeset: http://git.rtems.org/rtems/commit/?id=ceb136c7b64b388d293061f064d7b8ccdfd9c9ba

Author:    Chris Johns <chrisj at rtems.org>
Date:      Mon Aug 28 13:49:29 2023 +1000

cpukit/libdl: Fix incorrect operator precedence access the name

Coverity Issue: CID 1442635 Out-of-bounds access

---

 cpukit/libdl/rtl-archive.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cpukit/libdl/rtl-archive.c b/cpukit/libdl/rtl-archive.c
index f916336f7c..4a6d2cbf0b 100644
--- a/cpukit/libdl/rtl-archive.c
+++ b/cpukit/libdl/rtl-archive.c
@@ -1174,6 +1174,7 @@ rtems_rtl_obj_archive_find_obj (int                     fd,
      */
     if (header[0] == '/')
     {
+      const char* name_ = *name;
       off_t extended_off;
 
       switch (header[1])
@@ -1190,7 +1191,7 @@ rtems_rtl_obj_archive_find_obj (int                     fd,
            * return the result.
            */
           *extended_file_names = *ooffset + RTEMS_RTL_AR_FHDR_SIZE;
-          if (*name[0] == '/' && *name[1] == '/')
+          if (name_[0] == '/' && name_[1] == '/')
           {
             *ooffset = *ooffset + RTEMS_RTL_AR_FHDR_SIZE;
             return true;



More information about the vc mailing list