summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2014-11-20 10:18:16 +1100
committerChris Johns <chrisj@rtems.org>2014-11-20 10:18:16 +1100
commitfc523ac86987570823e1dcfd18b9938c652aeae8 (patch)
treec1aeff30057b76e6169f25cdb71e05b6bff4119b
parentlibdl: Add a comment. (diff)
downloadrtems-fc523ac86987570823e1dcfd18b9938c652aeae8.tar.bz2
libdl: Fix possible 16-bit overflow (Coverity 1255339) refs #2192.
On a 16-bit target the section value could result in a sign-extension overflow.
-rw-r--r--cpukit/libdl/rtl-elf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cpukit/libdl/rtl-elf.c b/cpukit/libdl/rtl-elf.c
index 46f5613014..3a432aa2ea 100644
--- a/cpukit/libdl/rtl-elf.c
+++ b/cpukit/libdl/rtl-elf.c
@@ -639,7 +639,7 @@ rtems_rtl_elf_parse_sections (rtems_rtl_obj_t* obj, int fd, Elf_Ehdr* ehdr)
{
uint32_t flags;
- off = obj->ooffset + ehdr->e_shoff + (section * ehdr->e_shentsize);
+ off = obj->ooffset + ehdr->e_shoff + (((uint32_t) section) * ehdr->e_shentsize);
if (!rtems_rtl_obj_cache_read_byval (sects, fd, off, &shdr, sizeof (shdr)))
return false;