/[gentoo-projects]/pax-utils/scanelf.c
Gentoo

Diff of /pax-utils/scanelf.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.275 Revision 1.276
1/* 1/*
2 * Copyright 2003-2012 Gentoo Foundation 2 * Copyright 2003-2012 Gentoo Foundation
3 * Distributed under the terms of the GNU General Public License v2 3 * Distributed under the terms of the GNU General Public License v2
4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/Attic/scanelf.c,v 1.275 2015/02/24 06:58:39 vapier Exp $ 4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/Attic/scanelf.c,v 1.276 2015/02/28 22:57:40 vapier Exp $
5 * 5 *
6 * Copyright 2003-2012 Ned Ludd - <solar@gentoo.org> 6 * Copyright 2003-2012 Ned Ludd - <solar@gentoo.org>
7 * Copyright 2004-2012 Mike Frysinger - <vapier@gentoo.org> 7 * Copyright 2004-2012 Mike Frysinger - <vapier@gentoo.org>
8 */ 8 */
9 9
10static const char rcsid[] = "$Id: scanelf.c,v 1.275 2015/02/24 06:58:39 vapier Exp $"; 10static const char rcsid[] = "$Id: scanelf.c,v 1.276 2015/02/28 22:57:40 vapier Exp $";
11const char argv0[] = "scanelf"; 11const char argv0[] = "scanelf";
12 12
13#include "paxinc.h" 13#include "paxinc.h"
14 14
15#define IS_MODIFIER(c) (c == '%' || c == '#' || c == '+') 15#define IS_MODIFIER(c) (c == '%' || c == '#' || c == '+')
187 Elf ## B ## _Shdr *esymtab = symtab; \ 187 Elf ## B ## _Shdr *esymtab = symtab; \
188 Elf ## B ## _Shdr *estrtab = strtab; \ 188 Elf ## B ## _Shdr *estrtab = strtab; \
189 Elf ## B ## _Shdr *edynsym = dynsym; \ 189 Elf ## B ## _Shdr *edynsym = dynsym; \
190 Elf ## B ## _Shdr *edynstr = dynstr; \ 190 Elf ## B ## _Shdr *edynstr = dynstr; \
191 \ 191 \
192 if (symtab && EGET(esymtab->sh_type) == SHT_NOBITS) \ 192 if (!VALID_SHDR(elf, esymtab)) \
193 symtab = NULL; \ 193 symtab = NULL; \
194 if (dynsym && EGET(edynsym->sh_type) == SHT_NOBITS) \ 194 if (!VALID_SHDR(elf, edynsym)) \
195 dynsym = NULL; \ 195 dynsym = NULL; \
196 if (strtab && EGET(estrtab->sh_type) == SHT_NOBITS) \ 196 if (!VALID_SHDR(elf, estrtab)) \
197 strtab = NULL; \ 197 strtab = NULL; \
198 if (dynstr && EGET(edynstr->sh_type) == SHT_NOBITS) \ 198 if (!VALID_SHDR(elf, edynstr)) \
199 dynstr = NULL; \ 199 dynstr = NULL; \
200 \ 200 \
201 /* Use the set with more symbols if both exist. */ \ 201 /* Use the set with more symbols if both exist. */ \
202 if (symtab && dynsym && strtab && dynstr) { \ 202 if (symtab && dynsym && strtab && dynstr) { \
203 if (EGET(esymtab->sh_size) > EGET(edynsym->sh_size)) \ 203 if (EGET(esymtab->sh_size) > EGET(edynsym->sh_size)) \
1402 Elf ## B ## _Shdr *strtab = SHDR ## B (strtab_void); \ 1402 Elf ## B ## _Shdr *strtab = SHDR ## B (strtab_void); \
1403 Elf ## B ## _Sym *sym = SYM ## B (elf->vdata + EGET(symtab->sh_offset)); \ 1403 Elf ## B ## _Sym *sym = SYM ## B (elf->vdata + EGET(symtab->sh_offset)); \
1404 Elf ## B ## _Word i, cnt = EGET(symtab->sh_entsize); \ 1404 Elf ## B ## _Word i, cnt = EGET(symtab->sh_entsize); \
1405 char *symname; \ 1405 char *symname; \
1406 size_t ret_len = 0; \ 1406 size_t ret_len = 0; \
1407 if (!VALID_SHDR(elf, symtab) || !VALID_SHDR(elf, strtab)) \
1408 goto break_out; \
1407 if (cnt) \ 1409 if (cnt) \
1408 cnt = EGET(symtab->sh_size) / cnt; \ 1410 cnt = EGET(symtab->sh_size) / cnt; \
1409 for (i = 0; i < cnt; ++i) { \ 1411 for (i = 0; i < cnt; ++i) { \
1410 if ((void*)sym > elf->data_end) { \ 1412 if ((void*)sym > elf->data_end) { \
1411 warnf("%s: corrupt ELF symbols - aborting", elf->filename); \ 1413 warnf("%s: corrupt ELF symbols - aborting", elf->filename); \

Legend:
Removed from v.1.275  
changed lines
  Added in v.1.276

  ViewVC Help
Powered by ViewVC 1.1.20