diff options
author | Mike Frysinger <vapier@gentoo.org> | 2005-06-17 01:39:43 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2005-06-17 01:39:43 +0000 |
commit | 06df17de5db07ad2e826ddaa8d1a7115cec4f90e (patch) | |
tree | d0e366023a8a3a5285a6fab3f84a905077f957b8 /paxelf.c | |
parent | allow env to override CFLAGS (diff) | |
download | pax-utils-06df17de5db07ad2e826ddaa8d1a7115cec4f90e.tar.gz pax-utils-06df17de5db07ad2e826ddaa8d1a7115cec4f90e.tar.bz2 pax-utils-06df17de5db07ad2e826ddaa8d1a7115cec4f90e.zip |
add a sanity check to make sure multiple sections dont have the same name
Diffstat (limited to 'paxelf.c')
-rw-r--r-- | paxelf.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -1,7 +1,7 @@ /* * Copyright 2003-2005 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 - * $Header: /var/cvsroot/gentoo-projects/pax-utils/paxelf.c,v 1.26 2005/06/08 04:16:35 vapier Exp $ + * $Header: /var/cvsroot/gentoo-projects/pax-utils/paxelf.c,v 1.27 2005/06/17 01:39:43 vapier Exp $ * ******************************************************************** * This program is free software; you can redistribute it and/or @@ -516,6 +516,7 @@ void *elf_findsecbyname(elfobj *elf, const char *name) { unsigned int i; char *shdr_name; + void *ret = NULL; if (elf->shdr == NULL) return NULL; @@ -534,11 +535,13 @@ void *elf_findsecbyname(elfobj *elf, const char *name) offset = EGET(strtbl->sh_offset) + EGET(shdr[i].sh_name); \ if (offset >= (Elf ## B ## _Off)elf->len) continue; \ shdr_name = (char*)(elf->data + offset); \ - if (!strcmp(shdr_name, name)) \ - return &(shdr[i]); \ + if (!strcmp(shdr_name, name)) { \ + if (ret) warnf("Multiple '%s' sections !?", name); \ + ret = (void*)&(shdr[i]); \ + } \ } } FINDSEC(32) FINDSEC(64) - return NULL; + return ret; } |