X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=libelf%2Fgelf_update_move.c;h=ad2ca6abcb4f51dd71eb0294f769b695c71f8c85;hb=a286dd013ef8d46edf013efc0908822a59d8ac81;hp=102a45b85ca13fbf837f677bc3d636e5bf2c2850;hpb=18a667176dd196f7bc3a9cdf1cbd87d4c7b31c7f;p=platform%2Fupstream%2Felfutils.git diff --git a/libelf/gelf_update_move.c b/libelf/gelf_update_move.c index 102a45b..ad2ca6a 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 , 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;