]> git.wh0rd.org - patches.git/blob - file-4.19-init-file.patch
initial import
[patches.git] / file-4.19-init-file.patch
1 When a new struct magic_set is created as the handle to the calling application
2 (in magic_open), the "file" char * is not NULLified. This causes unexplained
3 segfaults in other apps that don't properly have their magic.mgc file created,
4 i.e. in app-arch/rpm-4.4.6-r3. The file pointer is some random value, so when
5 file_magwarn tries to report a missing magic.mgc file, for example, it tries to
6 print ms->file, which is NULL, and the segfault occurs.
7
8 Fix by Jeff Hansen.
9
10 http://bugs.gentoo.org/163948
11
12 --- src/magic.c
13 +++ src/magic.c
14 @@ -110,6 +110,7 @@ magic_open(int flags)
15 ms->haderr = 0;
16 ms->error = -1;
17 ms->mlist = NULL;
18 + ms->file = NULL;
19 return ms;
20 free3:
21 free(ms->o.pbuf);