summaryrefslogtreecommitdiffstats
path: root/libelf/gelf_update_move.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_update_move.c
parent720383c53b435de6647edd78060dd7d38ade25a5 (diff)
robustify: libelf gelf define INVALID_NDX macro.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'libelf/gelf_update_move.c')
-rw-r--r--libelf/gelf_update_move.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/libelf/gelf_update_move.c b/libelf/gelf_update_move.c
index 102a45b8..ad2ca6ab 100644
--- a/libelf/gelf_update_move.c
+++ b/libelf/gelf_update_move.c
@@ -1,5 +1,5 @@
/* Update move structure 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.
@@ -54,8 +54,7 @@ gelf_update_move (data, ndx, src)
assert (sizeof (GElf_Move) == sizeof (Elf64_Move));
/* Check whether we have to resize the data buffer. */
- if (unlikely (ndx < 0)
- || unlikely ((ndx + 1) * sizeof (GElf_Move) > data_scn->d.d_size))
+ if (INVALID_NDX (ndx, GElf_Move, &data_scn->d))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
return 0;