[PATCH 2/2] cpukit/libdl: Fix incorrect operator precedence access the name
chrisj at rtems.org
chrisj at rtems.org
Mon Aug 28 04:04:21 UTC 2023
From: Chris Johns <chrisj at rtems.org>
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;
--
2.37.1
More information about the devel
mailing list