summaryrefslogtreecommitdiffstats
path: root/libelf/gelf_getsymshndx.c
diff options
context:
space:
mode:
authorJakub Jelinek <[email protected]>2014-01-17 20:38:01 +0100
committerMark Wielaard <[email protected]>2014-01-23 11:31:53 +0100
commita9039623c272f458a53f09009c2a0e1d6e60491d (patch)
tree89fbb96c4a083aaecf960871e02a4fd99085245f /libelf/gelf_getsymshndx.c
parent720383c53b435de6647edd78060dd7d38ade25a5 (diff)
robustify: libelf gelf define INVALID_NDX macro.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'libelf/gelf_getsymshndx.c')
-rw-r--r--libelf/gelf_getsymshndx.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libelf/gelf_getsymshndx.c b/libelf/gelf_getsymshndx.c
index 91e1bf60..c19e8761 100644
--- a/libelf/gelf_getsymshndx.c
+++ b/libelf/gelf_getsymshndx.c
@@ -1,6 +1,6 @@
/* Get symbol information and separate section index from symbol table
at the given index.
- Copyright (C) 2000, 2001, 2002 Red Hat, Inc.
+ Copyright (C) 2000, 2001, 2002, 2005, 2009, 2014 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <[email protected]>, 2000.
@@ -69,7 +69,7 @@ gelf_getsymshndx (symdata, shndxdata, ndx, dst, dstshndx)
section index table. */
if (likely (shndxdata_scn != NULL))
{
- if (unlikely ((ndx + 1) * sizeof (Elf32_Word) > shndxdata_scn->d.d_size))
+ if (INVALID_NDX (ndx, Elf32_Word, &shndxdata_scn->d))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
@@ -89,7 +89,7 @@ gelf_getsymshndx (symdata, shndxdata, ndx, dst, dstshndx)
table entries has to be adopted. The user better has provided
a buffer where we can store the information. While copying the
data we are converting the format. */
- if (unlikely ((ndx + 1) * sizeof (Elf32_Sym) > symdata->d_size))
+ if (INVALID_NDX (ndx, Elf32_Sym, symdata))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
@@ -118,7 +118,7 @@ gelf_getsymshndx (symdata, shndxdata, ndx, dst, dstshndx)
/* The data is already in the correct form. Just make sure the
index is OK. */
- if (unlikely ((ndx + 1) * sizeof (GElf_Sym) > symdata->d_size))
+ if (INVALID_NDX (ndx, GElf_Sym, symdata))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;