summaryrefslogtreecommitdiff
path: root/src/elflint.c
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2015-05-06 16:01:55 +0200
committerMark Wielaard <mjw@redhat.com>2015-05-12 16:47:30 +0200
commit9d0926538635fe9a2bda0684623516aaf4407ecb (patch)
tree611ecdc53b099164a853bd480995dc3c2bf9e02d /src/elflint.c
parent16e2ac344788f2bb08ae9dc0a20948f554ca560c (diff)
downloadelfutils-9d0926538635fe9a2bda0684623516aaf4407ecb.tar.gz
elflint: Use Use Elf64_Word for shdr->sh_info cnt.
On 32bit using int might overflow. https://bugzilla.redhat.com/show_bug.cgi?id=1170810#c31 Signed-off-by: Mark Wielaard <mjw@redhat.com>
Diffstat (limited to 'src/elflint.c')
-rw-r--r--src/elflint.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/elflint.c b/src/elflint.c
index 3abda718..4e536460 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -3037,8 +3037,10 @@ section [%2d] '%s': sh_link does not link to string table\n"),
return;
}
unsigned int offset = 0;
- for (int cnt = shdr->sh_info; --cnt >= 0; )
+ for (Elf64_Word cnt = shdr->sh_info; cnt > 0; )
{
+ cnt--;
+
/* Get the data at the next offset. */
GElf_Verneed needmem;
GElf_Verneed *need = gelf_getverneed (data, offset, &needmem);
@@ -3196,8 +3198,10 @@ section [%2d] '%s': sh_link does not link to string table\n"),
bool has_base = false;
unsigned int offset = 0;
- for (int cnt = shdr->sh_info; --cnt >= 0; )
+ for (Elf64_Word cnt = shdr->sh_info; cnt > 0; )
{
+ cnt--;
+
/* Get the data at the next offset. */
GElf_Verdef defmem;
GElf_Verdef *def = gelf_getverdef (data, offset, &defmem);