- fix #430952 - wrong handling of ELF binaries

This commit is contained in:
Tomas Smetana 2008-01-31 11:05:12 +00:00
parent b72a446e54
commit dc1236f07f
2 changed files with 36 additions and 1 deletions

30
file-4.23-tryelf.patch Normal file
View File

@ -0,0 +1,30 @@
diff -up file-4.23/src/readelf.c.tryelf file-4.23/src/readelf.c
--- file-4.23/src/readelf.c.tryelf 2008-01-31 08:05:27.000000000 +0100
+++ file-4.23/src/readelf.c 2008-01-31 08:04:07.000000000 +0100
@@ -983,7 +983,6 @@ file_tryelf(struct magic_set *ms, int fd
break;
#endif
case ET_EXEC:
- case ET_DYN:
if (dophn_exec(ms, class, swap,
fd, (off_t)getu32(swap, elfhdr.e_phoff),
getu16(swap, elfhdr.e_phnum),
@@ -991,6 +990,8 @@ file_tryelf(struct magic_set *ms, int fd
fsize, &flags, getu16(swap, elfhdr.e_shnum))
== -1)
return -1;
+ case ET_DYN:
+ default:
if (doshn(ms, class, swap, fd,
(off_t)getu32(swap, elfhdr.e_shoff),
getu16(swap, elfhdr.e_shnum),
@@ -998,9 +999,6 @@ file_tryelf(struct magic_set *ms, int fd
&flags) == -1)
return -1;
break;
-
- default:
- break;
}
return 1;
}

View File

@ -5,7 +5,7 @@
Summary: A utility for determining file types
Name: file
Version: 4.23
Release: 1%{?dist}
Release: 2%{?dist}
License: BSD
Group: Applications/File
Source0: ftp://ftp.astron.com/pub/file/file-%{version}.tar.gz
@ -24,6 +24,7 @@ Patch11: file-4.19-ooffice.patch
patch12: file-4.23-msoffice.patch
patch13: file-4.21-efi.patch
patch14: file-4.21-pybuild.patch
patch15: file-4.23-tryelf.patch
Requires: file-libs = %{version}-%{release}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -82,6 +83,7 @@ file(1) command.
%patch12 -p1 -b .msoffice
%patch13 -p1 -b .efi
%patch14 -p1 -b .pybuild
%patch15 -p1 -b .tryelf
iconv -f iso-8859-1 -t utf-8 < doc/libmagic.man > doc/libmagic.man_
touch -r doc/libmagic.man doc/libmagic.man_
@ -154,6 +156,9 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
* Thu Jan 31 2008 Tomas Smetana <tsmetana@redhat.com> - 4.23-2
- fix #430952 - wrong handling of ELF binaries
* Tue Jan 29 2008 Tomas Smetana <tsmetana@redhat.com> - 4.23-1
- new upstream version; update patches; drop unused patches