Fix magic files (#6178)

* magic: fix 'Printf format is too long' warnings

* magic: fix warning: Current entry does not yet have a description for adding a MIME type

* magic: fix mime type for debian packages

* magic: workaround for libmagic bug

libmagic currently warns about beshort/leshort type being
printed as "%hd" with the following warning:

Printf format is too long for type `leshort' in description `%hd'

As a workaround the short value can be printed using '%d'
without generating a warning.
This commit is contained in:
Sebastian Reichel 2016-11-12 11:10:09 +01:00 committed by radare
parent e9383b1441
commit 0deb096ea7
6 changed files with 36 additions and 28 deletions

View File

@ -19,9 +19,10 @@
# Debian package (needs to go before regular portable archives)
#
0 string =!<arch>\ndebian
!:mime application/x-debian-package
>8 string debian-split part of multipart Debian package
!:mime application/vnd.debian.binary-package
>8 string debian-binary Debian binary package
!:mime application/vnd.debian.binary-package
>8 string !debian
>68 string >\0 (format %s)
# These next two lines do not work, because a bzip2 Debian archive
@ -80,7 +81,7 @@
>9 string \0
>>0 string KWAJ
>>>7 string \321\003 MS Compress archive data
>>>>14 ulong >0 \b, original size: %ld bytes
>>>>14 ulong >0 \b, original size: %d bytes
>>>>18 ubyte >0x65
>>>>>18 string x \b, was %.8s
>>>>>(10.b-4) string x \b.%.3s
@ -237,7 +238,7 @@
# From: Dirk Jagdmann <doj@cubic.org>
# xar archive format: http://code.google.com/p/xar/
0 string xar! xar archive
>6 beshort x - version %ld
>6 beshort x - version %d
# From: "Nelson A. de Oliveira" <naoliv@gmail.com>
# .kgb

View File

@ -16,14 +16,14 @@
#
0 beshort 0xcafe
>2 beshort 0xbabe
>4 belong >30 compiled Java class data,
#>4 belong >30
!:mime application/x-java-applet
#>4 belong >30 compiled Java class data,
>4 belong >30
>>6 beshort <20
>>>6 beshort x compiled Java class data version %d.
>>>6 beshort x version %d.
>>>4 beshort x \b%d
>>>4 belong 1 Mach-O fat file with 1 architecture
>>>4 belong >1
>>>>4 belong <20 Mach-O fat file with %ld architectures
>>>>4 belong <20 Mach-O fat file with %d architectures
>2 beshort 0xd00d JAR compressed with pack200
!:mime application/x-java-pack200

View File

@ -931,7 +931,7 @@
>&-180 lelong x average file size %d,
>&-176 lelong x average number of files in dir %d,
>&-272 lequad x pending blocks to free %lld,
>&-264 lelong x pending inodes to free %ld,
>&-264 lelong x pending inodes to free %d,
>&-664 lequad x system-wide uuid %0llx,
>&-1316 lelong x minimum percentage of free blocks %d,
>&-1248 lelong 0 TIME optimization
@ -951,7 +951,7 @@
>&-180 lelong x average file size %d,
>&-176 lelong x average number of files in dir %d,
>&-272 lequad x pending blocks to free %lld,
>&-264 lelong x pending inodes to free %ld,
>&-264 lelong x pending inodes to free %d,
>&-664 lequad x system-wide uuid %0llx,
>&-1316 lelong x minimum percentage of free blocks %d,
>&-1248 lelong 0 TIME optimization
@ -991,7 +991,7 @@
>&-180 belong x average file size %d,
>&-176 belong x average number of files in dir %d,
>&-272 bequad x pending blocks to free %lld,
>&-264 belong x pending inodes to free %ld,
>&-264 belong x pending inodes to free %d,
>&-664 bequad x system-wide uuid %0llx,
>&-1316 belong x minimum percentage of free blocks %d,
>&-1248 belong 0 TIME optimization
@ -1011,7 +1011,7 @@
>&-180 belong x average file size %d,
>&-176 belong x average number of files in dir %d,
>&-272 bequad x pending blocks to free %lld,
>&-264 belong x pending inodes to free %ld,
>&-264 belong x pending inodes to free %d,
>&-664 bequad x system-wide uuid %0llx,
>&-1316 belong x minimum percentage of free blocks %d,
>&-1248 belong 0 TIME optimization
@ -1131,9 +1131,10 @@
# CDROM Filesystems
# Modified for UDF by gerardo.cacciari@gmail.com
32769 string CD001
!:mime application/x-iso9660-image
>38913 string !NSR0 ISO 9660 CD-ROM filesystem data
!:mime application/x-iso9660-image
>38913 string NSR0 UDF filesystem data
!:mime application/x-iso9660-image
>>38917 string 1 (version 1.0)
>>38917 string 2 (version 1.5)
>>38917 string 3 (version 2.0)
@ -1148,24 +1149,24 @@
# cramfs filesystem - russell@coker.com.au
0 lelong 0x28cd3d45 Linux Compressed ROM File System data, little endian
>4 lelong x size %lu
>4 lelong x size %u
>8 lelong &1 version #2
>8 lelong &2 sorted_dirs
>8 lelong &4 hole_support
>32 lelong x CRC 0x%x,
>36 lelong x edition %lu,
>40 lelong x %lu blocks,
>44 lelong x %lu files
>36 lelong x edition %u,
>40 lelong x %u blocks,
>44 lelong x %u files
0 belong 0x28cd3d45 Linux Compressed ROM File System data, big endian
>4 belong x size %lu
>4 belong x size %u
>8 belong &1 version #2
>8 belong &2 sorted_dirs
>8 belong &4 hole_support
>32 belong x CRC 0x%x,
>36 belong x edition %lu,
>40 belong x %lu blocks,
>44 belong x %lu files
>36 belong x edition %u,
>40 belong x %u blocks,
>44 belong x %u files
# reiserfs - russell@coker.com.au
0x10034 string ReIsErFs ReiserFS V3.5

View File

@ -15,8 +15,8 @@
>9 string file version 0,
>9 string v version
>>10 string >\0 %s,
>14 belong x %lu x
>18 belong x %lu,
>14 belong x %u x
>18 belong x %u,
>22 belong 0 RGB Color
>22 belong 1 Greyscale
>22 belong 2 Indexed Color

View File

@ -28,8 +28,8 @@
!:mime image/png
>4 belong !0x0d0a1a0a CORRUPTED,
>4 belong 0x0d0a1a0a
>>16 belong x %ld x
>>20 belong x %ld,
>>16 belong x %d x
>>20 belong x %d,
>>24 byte x %d-bit
>>25 byte 0 grayscale,
>>25 byte 2 \b/color RGB,
@ -46,8 +46,8 @@
!:mime image/gif
>4 string 7a \b, version 8%s,
>4 string 9a \b, version 8%s,
>6 leshort >0 %hd x
>8 leshort >0 %hd
>6 leshort >0 %d x
>8 leshort >0 %d
#>10 byte &0x80 color mapped,
#>10 byte&0x07 =0x00 2 colors
#>10 byte&0x07 =0x01 4 colors
@ -148,7 +148,7 @@
# Author: Hans-Joachim Baader <hjb@pro-linux.de>
0 string PaRtImAgE-VoLuMe PartImage
>0x0020 string 0.6.1 file version %s
>>0x0060 lelong >-1 volume %ld
>>0x0060 lelong >-1 volume %d
#>>0x0064 8 byte identifier
#>>0x007c reserved
>>0x0200 string >\0 type %s

View File

@ -40,8 +40,13 @@
#
#0 string MZ MS-DOS executable
0 string MZ
# All non-DOS EXE extensions have the relocation table more than 0x40 bytes into the file.
>0x18 leshort <0x40 MS-DOS executable
!:mime application/x-dosexec
>0 string MZ\0\0\0\0\0\0\0\0\0\0PE\0\0 \b, PE for MS Windows
!:mime application/x-dosexec
>>&18 leshort&0x2000 >0 (DLL)
>>&88 leshort 0 (unknown subsystem)
>>&88 leshort 1 (native)
@ -67,6 +72,7 @@
>0x18 leshort >0x3f
>>(0x3c.l) string PE\0\0 PE
!:mime application/x-dosexec
# hooray, there's a DOS extender using the PE format, with a valid PE
# executable inside (which just prints a message and exits if run in win)
>>>(8.s*16) string 32STUB for MS-DOS, 32rtm DOS extender
@ -561,7 +567,7 @@
# Using the existence of the Backing File Offset to Branch or not
# to read Backing File Information
>>0xc belong >0 , Backing File( Offset: %lu
>>0xc belong >0 , Backing File( Offset: %u
>>>(0xc.L) string >\0 , Path: %s
# Didn't get the trick here how qemu stores the "Size" at this Position