scummvm random work
[patches.git] / file-4.19-init-file.patch
CommitLineData
5e993f12 1When 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
3segfaults in other apps that don't properly have their magic.mgc file created,
4i.e. in app-arch/rpm-4.4.6-r3. The file pointer is some random value, so when
5file_magwarn tries to report a missing magic.mgc file, for example, it tries to
6print ms->file, which is NULL, and the segfault occurs.
7
8Fix by Jeff Hansen.
9
10http://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);