fix #980446 - do not segfault when no magic is loaded
This commit is contained in:
parent
20ce5f4a13
commit
52d4cf9f03
@ -11,3 +11,18 @@ index 7fc0e5c..4641c8b 100644
|
||||
file_error(ms, 0, "no magic files loaded");
|
||||
return -1;
|
||||
}
|
||||
diff --git a/src/softmagic.c b/src/softmagic.c
|
||||
index def1e63..108d419 100644
|
||||
--- a/src/softmagic.c
|
||||
+++ b/src/softmagic.c
|
||||
@@ -73,6 +73,10 @@ file_softmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes,
|
||||
{
|
||||
struct mlist *ml;
|
||||
int rv, printed_something = 0, need_separator = 0;
|
||||
+
|
||||
+ if (!ms->mlist[0])
|
||||
+ return 0;
|
||||
+
|
||||
for (ml = ms->mlist[0]->next; ml != ms->mlist[0]; ml = ml->next)
|
||||
if ((rv = match(ms, ml->magic, ml->nmagic, buf, nbytes, 0, mode,
|
||||
text, 0, 0, &printed_something, &need_separator,
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
Summary: A utility for determining file types
|
||||
Name: file
|
||||
Version: 5.14
|
||||
Release: 8%{?dist}
|
||||
Release: 9%{?dist}
|
||||
License: BSD
|
||||
Group: Applications/File
|
||||
Source0: ftp://ftp.astron.com/pub/file/file-%{version}.tar.gz
|
||||
@ -153,6 +153,9 @@ cd python
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue Jul 02 2013 Jan Kaluza <jkaluza@redhat.com> - 5.14-9
|
||||
- fix #980446 - do not segfault when no magic is loaded
|
||||
|
||||
* Mon Jun 17 2013 Jan Kaluza <jkaluza@redhat.com> - 5.14-8
|
||||
- replace sitearch with sitelib
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user