cpukit/libdl: Fix incorrect operator precedence access the name

Coverity Issue: CID 1442635 Out-of-bounds access
This commit is contained in:
Chris Johns
2023-08-28 13:49:29 +10:00
parent ac6de5a3e9
commit ceb136c7b6

View File

@@ -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;