From: Peter Avalos Date: Mon, 16 May 2011 03:59:10 +0000 (-1000) Subject: Import file-5.07. X-Git-Tag: v2.12.0~607^2 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/884044a574904c56cc0441938f957625f5153d6c Import file-5.07. This fixes a buffer overflow and magic regressions. --- diff --git a/contrib/file/ChangeLog b/contrib/file/ChangeLog index 91f59dcd26..5fcd1fa105 100644 --- a/contrib/file/ChangeLog +++ b/contrib/file/ChangeLog @@ -1,3 +1,9 @@ +2011-05-10 20:57 Christos Zoulas + + * remove patchlevel.h + * Fix read past allocated memory caused by double-incrementing + a pointer in a loop (reported by Roberto Maar) + 2011-03-30 15:45 Christos Zoulas * Fix cdf string buffer setting (Sven Anders) diff --git a/contrib/file/doc/file.man b/contrib/file/doc/file.man index 1333e27d2f..6a17b971b3 100644 --- a/contrib/file/doc/file.man +++ b/contrib/file/doc/file.man @@ -1,5 +1,5 @@ -.\" $File: file.man,v 1.93 2011/03/12 19:01:27 rrt Exp $ -.Dd July 23, 2010 +.\" $File: file.man,v 1.94 2011/04/20 19:08:44 christos Exp $ +.Dd April 20, 2011 .Dt FILE __CSECTION__ .Os .Sh NAME diff --git a/contrib/file/doc/magic.man b/contrib/file/doc/magic.man index 8d16a30175..1033d532ce 100644 --- a/contrib/file/doc/magic.man +++ b/contrib/file/doc/magic.man @@ -1,5 +1,5 @@ -.\" $File: magic.man,v 1.66 2011/01/06 23:54:41 rrt Exp $ -.Dd August 30, 2008 +.\" $File: magic.man,v 1.68 2011/04/20 19:08:44 christos Exp $ +.Dd April 20, 2011 .Dt MAGIC __FSECTION__ .Os .\" install as magic.4 on USG, magic.5 on V7, Berkeley and Linux systems. @@ -51,9 +51,9 @@ A 64-bit double precision IEEE floating point number in this machine's native by .It Dv string A string of bytes. The string type specification can be optionally followed -by /[Bbc]*. +by /[WwcCtb]*. The -.Dq B +.Dq W flag compacts whitespace in the target, which must contain at least one whitespace character. If the magic has @@ -62,14 +62,29 @@ consecutive blanks, the target needs at least .Dv n consecutive blanks to match. The -.Dq b +.Dq w flag treats every blank in the target as an optional blank. -Finally the +The .Dq c -flag, specifies case insensitive matching: lowercase +flag, specifies case insensitive matching: lower case +characters in the magic match both lower and upper case characters in the +target, whereas upper case characters in the magic only match upper case +characters in the target. +The +.Dq C +flag, specifies case insensitive matching: upper case characters in the magic match both lower and upper case characters in the -target, whereas upper case characters in the magic only match uppercase +target, whereas lower case characters in the magic only match upper case characters in the target. +To do a complete case insensitive match, specify both +.Dq c +and +.Dq C . +The +.Dq t +flag, forces the test to be done for text files, while the +.Dq b +flag, forces the test to be done for binary files. .It Dv pstring A Pascal-style string where the first byte/short/int is interpreted as the an unsigned length. diff --git a/contrib/file/magic/Magdir/alpha b/contrib/file/magic/Magdir/alpha deleted file mode 100644 index f1bdb6d7f2..0000000000 --- a/contrib/file/magic/Magdir/alpha +++ /dev/null @@ -1,32 +0,0 @@ - -#------------------------------------------------------------------------------ -# $File: alpha,v 1.7 2009/09/19 16:28:07 christos Exp $ -# alpha architecture description -# - -0 leshort 0603 COFF format alpha ->22 leshort&030000 !020000 executable ->24 leshort 0410 pure ->24 leshort 0413 paged ->22 leshort&020000 !0 dynamically linked ->16 lelong !0 not stripped ->16 lelong 0 stripped ->22 leshort&030000 020000 shared library ->24 leshort 0407 object ->27 byte x - version %d ->26 byte x .%d ->28 byte x -%d - -# Basic recognition of Digital UNIX core dumps - Mike Bremford -# -# The actual magic number is just "Core", followed by a 2-byte version -# number; however, treating any file that begins with "Core" as a Digital -# UNIX core dump file may produce too many false hits, so we include one -# byte of the version number as well; DU 5.0 appears only to be up to -# version 2. -# -0 string Core\001 Alpha COFF format core dump (Digital UNIX) ->24 string >\0 \b, from '%s' -0 string Core\002 Alpha COFF format core dump (Digital UNIX) ->24 string >\0 \b, from '%s' - diff --git a/contrib/file/magic/Magdir/archive b/contrib/file/magic/Magdir/archive index c998e5b899..a66f2ac660 100644 --- a/contrib/file/magic/Magdir/archive +++ b/contrib/file/magic/Magdir/archive @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------ -# $File: archive,v 1.62 2011/01/07 20:24:25 christos Exp $ +# $File: archive,v 1.63 2011/04/23 15:02:48 christos Exp $ # archive: file(1) magic for archive formats (see also "msdos" for self- # extracting compressed archives) # @@ -654,6 +654,12 @@ >>>>78 string -template Template !:mime application/vnd.oasis.opendocument.image-template +# StarView Metafile +# From Pierre Ducroquet +0 string VCLMTF StarView MetaFile +>6 beshort x \b, version %d +>8 belong x \b, size %d + # EPUB (OEBPS) books using OCF (OEBPS Container Format) # From: Adam Buchbinder # http://www.idpf.org/ocf/ocf1.0/download/ocf10.htm, section 4. diff --git a/contrib/file/magic/Magdir/blcr b/contrib/file/magic/Magdir/blcr index 9ccd4dc4f0..70ea563e18 100644 --- a/contrib/file/magic/Magdir/blcr +++ b/contrib/file/magic/Magdir/blcr @@ -21,5 +21,5 @@ # Uncomment the following only of your "file" program supports "search" #>0 search/1024 VMA\06 for kernel #>>&1 byte x %d. -#>>&2 byte x %d. -#>>&3 byte x %d +#>>&2 byte x \b%d. +#>>&3 byte x \b%d diff --git a/contrib/file/magic/Magdir/commands b/contrib/file/magic/Magdir/commands index ae3756f45e..caba654137 100644 --- a/contrib/file/magic/Magdir/commands +++ b/contrib/file/magic/Magdir/commands @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: commands,v 1.39 2010/11/25 15:00:12 christos Exp $ +# $File: commands,v 1.41 2011/05/02 12:36:41 christos Exp $ # commands: file(1) magic for various shells and interpreters # #0 string/w : shell archive or script for antique kernel text @@ -82,12 +82,17 @@ !:mime text/x-php 0 search/1/w #!\ /usr/bin/php PHP script text executable !:mime text/x-php +# Smarty compiled template, http://www.smarty.net/ +# Elan Ruusamäe +0 string =24 regex [0-9.]+ \b, version %s +!:mime text/x-php 0 string Zend\x00 PHP script Zend Optimizer data -0 string/t $! DCL command file +0 string/t $! DCL command file # Type: Pdmenu # URL: http://packages.debian.org/pdmenu # From: Edward Betts -0 string #!/usr/bin/pdmenu Pdmenu configuration file text +0 string #!/usr/bin/pdmenu Pdmenu configuration file text diff --git a/contrib/file/magic/Magdir/digital b/contrib/file/magic/Magdir/digital index 7f08b44e57..b1b77dd8c7 100644 --- a/contrib/file/magic/Magdir/digital +++ b/contrib/file/magic/Magdir/digital @@ -1,26 +1,40 @@ #------------------------------------------------------------------------------ -# $File: digital,v 1.8 2009/09/19 16:28:08 christos Exp $ +# $File: digital,v 1.10 2011/05/03 01:44:17 christos Exp $ # Digital UNIX - Info # 0 string =!\n________64E Alpha archive >22 string X -- out of date # -# Alpha COFF Based Executables -# The stripped stuff really needs to be an 8 byte (64 bit) compare, -# but this works -0 leshort 0x183 COFF format alpha ->22 leshort&020000 &010000 sharable library, ->22 leshort&020000 ^010000 dynamically linked, ->24 leshort 0410 pure ->24 leshort 0413 demand paged ->8 lelong >0 executable or object module, not stripped ->8 lelong 0 ->>12 lelong 0 executable or object module, stripped ->>12 lelong >0 executable or object module, not stripped ->27 byte >0 - version %d. ->26 byte >0 %d- ->28 leshort >0 %d + +0 leshort 0603 +>>24 leshort 0410 COFF format alpha pure +>>24 leshort 0413 COFF format alpha demand paged +>>>22 leshort&030000 !020000 executable +>>>22 leshort&020000 !0 dynamically linked +>>>16 lelong !0 not stripped +>>>16 lelong 0 stripped +>>>27 byte x - version %d +>>>26 byte x \b.%d +>>>28 byte x \b-%d +>>24 leshort 0407 COFF format alpha object +>>>22 leshort&030000 020000 shared library +>>>27 byte x - version %d +>>>26 byte x \b.%d +>>>28 byte x \b-%d + +# Basic recognition of Digital UNIX core dumps - Mike Bremford +# +# The actual magic number is just "Core", followed by a 2-byte version +# number; however, treating any file that begins with "Core" as a Digital +# UNIX core dump file may produce too many false hits, so we include one +# byte of the version number as well; DU 5.0 appears only to be up to +# version 2. +# +0 string Core\001 Alpha COFF format core dump (Digital UNIX) +>24 string >\0 \b, from '%s' +0 string Core\002 Alpha COFF format core dump (Digital UNIX) +>24 string >\0 \b, from '%s' # # The next is incomplete, we could tell more about this format, # but its not worth it. diff --git a/contrib/file/magic/Magdir/linux b/contrib/file/magic/Magdir/linux index cce2b01314..9b9b86c02a 100644 --- a/contrib/file/magic/Magdir/linux +++ b/contrib/file/magic/Magdir/linux @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: linux,v 1.40 2011/03/22 12:54:35 christos Exp $ +# $File: linux,v 1.41 2011/04/20 18:57:10 christos Exp $ # linux: file(1) magic for Linux files # # Values for Linux/i386 binaries, from Daniel Quinlan @@ -88,20 +88,6 @@ # From Daniel Novotny # swap file for PowerPC 65526 string SWAPSPACE2 Linux/ppc swap file -# ECOFF magic for OSF/1 and Linux (only tested under Linux though) -# -# from Erik Troan (ewt@redhat.com) examining od dumps, so this -# could be wrong -# updated by David Mosberger (davidm@azstarnet.com) based on -# GNU BFD and MIPS info found below. -# -0 leshort 0x0183 ECOFF alpha ->24 leshort 0407 executable ->24 leshort 0410 pure ->24 leshort 0413 demand paged ->8 long >0 not stripped ->8 long 0 stripped ->23 leshort >0 - version %ld. # # Linux kernel boot images, from Albert Cahalan # and others such as Axel Kohlmeyer diff --git a/contrib/file/magic/Magdir/mips b/contrib/file/magic/Magdir/mips index b0c496edbf..b49fecd24e 100644 --- a/contrib/file/magic/Magdir/mips +++ b/contrib/file/magic/Magdir/mips @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: mips,v 1.6 2010/08/13 16:12:30 christos Exp $ +# $File: mips,v 1.7 2011/05/03 01:44:17 christos Exp $ # mips: file(1) magic for Silicon Graphics (MIPS, IRIS, IRIX, etc.) # Dec Ultrix (MIPS) # all of SGI's *current* machines and OSes run in big-endian mode on the @@ -35,7 +35,7 @@ >8 belong >0 not stripped >8 belong 0 stripped >22 byte x - version %ld ->23 byte x .%ld +>23 byte x \b.%ld # 0 beshort 0x0162 MIPSEL-BE ECOFF executable >20 beshort 0407 (impure) @@ -44,7 +44,7 @@ >8 belong >0 not stripped >8 belong 0 stripped >23 byte x - version %d ->22 byte x .%ld +>22 byte x \b.%ld # 0 beshort 0x6001 MIPSEB-LE ECOFF executable >20 beshort 03401 (impure) @@ -53,7 +53,7 @@ >8 belong >0 not stripped >8 belong 0 stripped >23 byte x - version %d ->22 byte x .%ld +>22 byte x \b.%ld # 0 beshort 0x6201 MIPSEL ECOFF executable >20 beshort 03401 (impure) @@ -62,7 +62,7 @@ >8 belong >0 not stripped >8 belong 0 stripped >23 byte x - version %ld ->22 byte x .%ld +>22 byte x \b.%ld # # MIPS 2 additions # @@ -73,7 +73,7 @@ >8 belong >0 not stripped >8 belong 0 stripped >22 byte x - version %ld ->23 byte x .%ld +>23 byte x \b.%ld # 0 beshort 0x0166 MIPSEL-BE MIPS-II ECOFF executable >20 beshort 0407 (impure) @@ -82,7 +82,7 @@ >8 belong >0 not stripped >8 belong 0 stripped >22 byte x - version %ld ->23 byte x .%ld +>23 byte x \b.%ld # 0 beshort 0x6301 MIPSEB-LE MIPS-II ECOFF executable >20 beshort 03401 (impure) @@ -91,7 +91,7 @@ >8 belong >0 not stripped >8 belong 0 stripped >23 byte x - version %ld ->22 byte x .%ld +>22 byte x \b.%ld # 0 beshort 0x6601 MIPSEL MIPS-II ECOFF executable >20 beshort 03401 (impure) @@ -100,7 +100,7 @@ >8 belong >0 not stripped >8 belong 0 stripped >23 byte x - version %ld ->22 byte x .%ld +>22 byte x \b.%ld # # MIPS 3 additions # @@ -111,7 +111,7 @@ >8 belong >0 not stripped >8 belong 0 stripped >22 byte x - version %ld ->23 byte x .%ld +>23 byte x \b.%ld # 0 beshort 0x0142 MIPSEL-BE MIPS-III ECOFF executable >20 beshort 0407 (impure) @@ -120,7 +120,7 @@ >8 belong >0 not stripped >8 belong 0 stripped >22 byte x - version %ld ->23 byte x .%ld +>23 byte x \b.%ld # 0 beshort 0x4001 MIPSEB-LE MIPS-III ECOFF executable >20 beshort 03401 (impure) @@ -129,7 +129,7 @@ >8 belong >0 not stripped >8 belong 0 stripped >23 byte x - version %ld ->22 byte x .%ld +>22 byte x \b.%ld # 0 beshort 0x4201 MIPSEL MIPS-III ECOFF executable >20 beshort 03401 (impure) @@ -138,7 +138,7 @@ >8 belong >0 not stripped >8 belong 0 stripped >23 byte x - version %ld ->22 byte x .%ld +>22 byte x \b.%ld # 0 beshort 0x180 MIPSEB Ucode 0 beshort 0x182 MIPSEL-BE Ucode @@ -160,7 +160,7 @@ # Trusted IRIX info 0 string SGIAUDIT SGI Audit file >8 byte x - version %d ->9 byte x .%ld +>9 byte x \b.%ld # 0 string WNGZWZSC Wingz compiled script 0 string WNGZWZSS Wingz spreadsheet diff --git a/contrib/file/magic/Magdir/msdos b/contrib/file/magic/Magdir/msdos index 456166e840..7a79fbf7b4 100644 --- a/contrib/file/magic/Magdir/msdos +++ b/contrib/file/magic/Magdir/msdos @@ -1,17 +1,17 @@ #------------------------------------------------------------------------------ -# $File: msdos,v 1.71 2011/01/10 14:01:10 christos Exp $ +# $File: msdos,v 1.72 2011/05/08 01:21:41 christos Exp $ # msdos: file(1) magic for MS-DOS files # # .BAT files (Daniel Quinlan, quinlan@yggdrasil.com) -# updated by Joerg Jenderek at Oct 2008 +# updated by Joerg Jenderek at Oct 2008,Apr 2011 0 string/t @ >1 string/cW \ echo\ off DOS batch file text !:mime text/x-msdos-batch >1 string/cW echo\ off DOS batch file text !:mime text/x-msdos-batch ->1 string/cW rem\ DOS batch file text +>1 string/cW rem DOS batch file text !:mime text/x-msdos-batch >1 string/cW set\ DOS batch file text !:mime text/x-msdos-batch @@ -291,6 +291,29 @@ >>49824 leshort =1 \b, 1 file >>49824 leshort >1 \b, %u files +# added by Joerg Jenderek of http://www.freedos.org/software/?prog=kc +# and http://www.freedos.org/software/?prog=kpdos +# for FreeDOS files like KEYBOARD.SYS, KEYBRD2.SYS, KEYBRD3.SYS, *.KBD +0 string KCF FreeDOS KEYBoard Layout collection +# only version=0x100 found +>3 uleshort x \b, version 0x%x +# length of string containing author,info and special characters +>6 ubyte >0 +#>>6 pstring x \b, name=%s +>>7 string >\0 \b, author=%-.14s +>>7 search/254 \xff \b, info= +#>>>&0 string x \b%-s +>>>&0 string x \b%-.15s +# for FreeDOS *.KL files +0 string KLF FreeDOS KEYBoard Layout file +# only version=0x100 or 0x101 found +>3 uleshort x \b, version 0x%x +# stringlength +>5 ubyte >0 +>>8 string x \b, name=%-.2s +0 string \xffKEYB\ \ \ \0\0\0\0 +>12 string \0\0\0\0`\360 MS-DOS KEYBoard Layout file + # .COM formats (Daniel Quinlan, quinlan@yggdrasil.com) # Uncommenting only the first two lines will cover about 2/3 of COM files, # but it isn't feasible to match all COM files since there must be at least @@ -299,27 +322,78 @@ 0 byte 0xe9 DOS executable (COM) >0x1FE leshort 0xAA55 \b, boot code >6 string SFX\ of\ LHarc (%s) -0 belong 0xffffffff DOS executable (device driver) -#CMD640X2.SYS ->10 string >\x23 ->>10 string !\x2e ->>>17 string <\x5B ->>>>10 string x \b, name: %.8s -#UDMA.SYS KEYB.SYS CMD640X2.SYS ->10 string <\x41 ->>12 string >\x40 ->>>10 string !$ ->>>>12 string x \b, name: %.8s -#BTCDROM.SYS ASPICD.SYS ->22 string >\x40 ->>22 string <\x5B ->>>23 string <\x5B ->>>>22 string x \b, name: %.8s -#ATAPICD.SYS ->76 string \0 ->>77 string >\x40 ->>>77 string <\x5B ->>>>77 string x \b, name: %.8s + +# DOS device driver updated by Joerg Jenderek at May 2011 +# http://maben.homeip.net/static/S100/IBM/software/DOS/DOS%20techref/CHAPTER.009 +0 ulequad&0x07a0ffffffff 0xffffffff DOS executable ( +>40 search/7 UPX! \bUPX compressed +# DOS device driver attributes +>4 uleshort&0x8000 0x0000 \bblock device driver +# character device +>4 uleshort&0x8000 0x8000 \b +>>4 uleshort&0x0008 0x0008 \bclock +# fast video output by int 29h +>>4 uleshort&0x0010 0x0010 \bfast +# standard input/output device +>>4 uleshort&0x0003 >0 \bstandard +>>>4 uleshort&0x0001 0x0001 \binput +>>>4 uleshort&0x0003 0x0003 \b/ +>>>4 uleshort&0x0002 0x0002 \boutput +>>4 uleshort&0x8000 0x8000 \bcharacter device driver +>0 ubyte x +# upx compressed device driver has garbage instead of real in name field of header +>>40 search/7 UPX! +>>40 default x +# leading/trailing nulls, zeros or non ASCII characters in 8-byte name field at offset 10 are skipped +>>>12 ubyte >0x27 \b +>>>>10 ubyte >0x20 +>>>>>10 ubyte !0x2E +>>>>>>10 ubyte !0x2A \b%c +>>>>11 ubyte >0x20 +>>>>>11 ubyte !0x2E \b%c +>>>>12 ubyte >0x20 +>>>>>12 ubyte !0x39 +>>>>>>12 ubyte !0x2E \b%c +>>>13 ubyte >0x20 +>>>>13 ubyte !0x2E \b%c +>>>>14 ubyte >0x20 +>>>>>14 ubyte !0x2E \b%c +>>>>15 ubyte >0x20 +>>>>>15 ubyte !0x2E \b%c +>>>>16 ubyte >0x20 +>>>>>16 ubyte !0x2E +>>>>>>16 ubyte <0xCB \b%c +>>>>17 ubyte >0x20 +>>>>>17 ubyte !0x2E +>>>>>>17 ubyte <0x90 \b%c +# some character device drivers like ASPICD.SYS, btcdrom.sys and Cr_atapi.sys contain only spaces or points in name field +>>>4 uleshort&0x8000 0x8000 +>>>>12 ubyte <0x2F +# they have their real name at offset 22 +>>>>>22 string >\0 \b%-.5s +>4 uleshort&0x8000 0x0000 +# 32 bit sector adressing ( > 32 MB) for block devices +>>4 uleshort&0x0002 0x0002 \b,32-bit sector- +# support by driver functions 13h, 17h, 18h +>4 uleshort&0x0040 0x0040 \b,IOCTL- +# open, close, removable media support by driver functions 0Dh, 0Eh, 0Fh +>4 uleshort&0x0800 0x0800 \b,close media- +# output until busy support by int 10h for character device driver +>4 uleshort&0x8000 0x8000 +>>4 uleshort&0x2000 0x2000 \b,until busy- +# direct read/write support by driver functions 03h,0Ch +>4 uleshort&0x4000 0x4000 \b,control strings- +>4 uleshort&0x8000 0x8000 +>>4 uleshort&0x6840 >0 \bsupport +>4 uleshort&0x8000 0x0000 +>>4 uleshort&0x4842 >0 \bsupport +>0 ubyte x \b) +# DOS driver cmd640x.sys has 0x12 instead of 0xffffffff for pointer field to next device header +0 ulequad&0x000007a0ffffffed 0x0000000000000000 DOS-executable ( +>4 uleshort&0x8000 0x8000 \bcharacter device driver +>>10 string x %-.8s +>4 uleshort&0x4000 0x4000 \b,control strings-support) + # test too generic ? 0 byte 0x8c DOS executable (COM) # updated by Joerg Jenderek at Oct 2008 @@ -577,6 +651,39 @@ 0 lelong 0x4C >4 lelong 0x00021401 Windows shortcut file +# .PIF files added by Joerg Jenderek from http://smsoft.ru/en/pifdoc.htm +# only for windows versions equal or greater 3.0 +0x171 string MICROSOFT\ PIFEX\0 Windows Program Information File +!:mime application/x-dosexec +#>2 string >\0 \b, Title:%.30s +>0x24 string >\0 \b for %.63s +>0x65 string >\0 \b, directory=%.64s +>0xA5 string >\0 \b, parameters=%.64s +#>0x181 leshort x \b, offset %x +#>0x183 leshort x \b, offsetdata %x +#>0x185 leshort x \b, section length %x +>0x187 search/0xB55 WINDOWS\ VMM\ 4.0\0 +>>&0x5e ubyte >0 +>>>&-1 string >>&-1 string PIFMGR.DLL \b, icon=%s +>>>&-1 string >PIFMGR.DLL \b, icon=%s +>>&0xF0 ubyte >0 +>>>&-1 string >>&-1 string =Terminal \b, font=%.32s +>>>&-1 string >Terminal \b, font=%.32s +>>&0x110 ubyte >0 +>>>&-1 string >>&-1 string =Lucida\ Console \b, TrueTypeFont=%.32s +>>>&-1 string >Lucida\ Console \b, TrueTypeFont=%.32s +#>0x187 search/0xB55 WINDOWS\ 286\ 3.0\0 \b, Windows 3.X standard mode-style +#>0x187 search/0xB55 WINDOWS\ 386\ 3.0\0 \b, Windows 3.X enhanced mode-style +>0x187 search/0xB55 WINDOWS\ NT\ \ 3.1\0 \b, Windows NT-style +#>0x187 search/0xB55 WINDOWS\ NT\ \ 4.0\0 \b, Windows NT-style +>0x187 search/0xB55 CONFIG\ \ SYS\ 4.0\0 \b +CONFIG.SYS +#>>&06 string x \b:%s +>0x187 search/0xB55 AUTOEXECBAT\ 4.0\0 \b +AUTOEXEC.BAT +#>>&06 string x \b:%s + # DOS EPS Binary File Header # From: Ed Sznyter 0 belong 0xC5D0D3C6 DOS EPS Binary File diff --git a/contrib/file/magic/Magdir/printer b/contrib/file/magic/Magdir/printer index bf6d2e897c..e2b0b76418 100644 --- a/contrib/file/magic/Magdir/printer +++ b/contrib/file/magic/Magdir/printer @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: printer,v 1.23 2010/11/25 15:00:12 christos Exp $ +# $File: printer,v 1.24 2011/05/08 16:34:51 christos Exp $ # printer: file(1) magic for printer-formatted files # @@ -64,6 +64,10 @@ #>15 string \ ENTER\ LANGUAGE\ = #>31 string PostScript PostScript +# From: Stefan Thurner +0 string \033%-12345X@PJL +>&0 search/10000 %! PJL encapsulated PostScript document text + # HP Printer Control Language, Daniel Quinlan (quinlan@yggdrasil.com) 0 string \033E\033 HP PCL printer data >3 string \&l0A - default page size diff --git a/contrib/file/magic/Magdir/rinex b/contrib/file/magic/Magdir/rinex index 337f639ad9..c5f2bcbd31 100644 --- a/contrib/file/magic/Magdir/rinex +++ b/contrib/file/magic/Magdir/rinex @@ -1,44 +1,44 @@ #------------------------------------------------------------------------------ -# $File: rinex,v 1.3 2011/04/04 21:12:03 christos Exp $ +# $File: rinex,v 1.4 2011/05/03 01:44:17 christos Exp $ # rinex: file(1) magic for RINEX files # http://igscb.jpl.nasa.gov/igscb/data/format/rinex210.txt # ftp://cddis.gsfc.nasa.gov/pub/reports/formats/rinex300.pdf # data for testing: ftp://cddis.gsfc.nasa.gov/pub/gps/data 60 string RINEX >80 search/256 XXRINEXB RINEX Data, GEO SBAS Broadcast ->>&32 string x , date %15.15s ->>5 string x , version %6.6s +>>&32 string x \b, date %15.15s +>>5 string x \b, version %6.6s !:mime rinex/broadcast >80 search/256 XXRINEXD RINEX Data, Observation (Hatanaka comp) ->>&32 string x , date %15.15s ->>5 string x , version %6.6s +>>&32 string x \b, date %15.15s +>>5 string x \b, version %6.6s !:mime rinex/observation >80 search/256 XXRINEXC RINEX Data, Clock ->>&32 string x , date %15.15s ->>5 string x , version %6.6s +>>&32 string x \b, date %15.15s +>>5 string x \b, version %6.6s !:mime rinex/clock >80 search/256 XXRINEXH RINEX Data, GEO SBAS Navigation ->>&32 string x , date %15.15s ->>5 string x , version %6.6s +>>&32 string x \b, date %15.15s +>>5 string x \b, version %6.6s !:mime rinex/navigation >80 search/256 XXRINEXG RINEX Data, GLONASS Navigation ->>&32 string x , date %15.15s ->>5 string x , version %6.6s +>>&32 string x \b, date %15.15s +>>5 string x \b, version %6.6s !:mime rinex/navigation >80 search/256 XXRINEXL RINEX Data, Galileo Navigation ->>&32 string x , date %15.15s ->>5 string x , version %6.6s +>>&32 string x \b, date %15.15s +>>5 string x \b, version %6.6s !:mime rinex/navigation >80 search/256 XXRINEXM RINEX Data, Meteorological ->>&32 string x , date %15.15s ->>5 string x , version %6.6s +>>&32 string x \b, date %15.15s +>>5 string x \b, version %6.6s !:mime rinex/meteorological >80 search/256 XXRINEXN RINEX Data, Navigation ->>&32 string x , date %15.15s ->>5 string x , version %6.6s +>>&32 string x \b, date %15.15s +>>5 string x \b, version %6.6s !:mime rinex/navigation >80 search/256 XXRINEXO RINEX Data, Observation ->>&32 string x , date %15.15s ->>5 string x , version %6.6s +>>&32 string x \b, date %15.15s +>>5 string x \b, version %6.6s !:mime rinex/observation diff --git a/contrib/file/magic/Magdir/sgml b/contrib/file/magic/Magdir/sgml index 65cd26f7e1..6843e332d7 100644 --- a/contrib/file/magic/Magdir/sgml +++ b/contrib/file/magic/Magdir/sgml @@ -1,8 +1,8 @@ #------------------------------------------------------------------------------ -# $File: sgml,v 1.25 2010/11/25 15:00:12 christos Exp $ +# $File: sgml,v 1.26 2011/04/16 15:20:04 christos Exp $ # Type: SVG Vectorial Graphics # From: Noel Torres -0 string/t \15 string >\0 >>19 search/4096 \4 long x - version %ld >8 long x - [%ld - ->20 long x %ldx ->24 long x %ldx ->28 long 1008 YUV422] ->28 long 1000 RGB24] +>20 long x \b%ldx +>24 long x \b%ldx +>28 long 1008 \bYUV422] +>28 long 1000 \bRGB24] # Xcursor data # X11 mouse cursor format defined in libXcursor, see diff --git a/contrib/file/src/apprentice.c b/contrib/file/src/apprentice.c index e12efa31be..b531485dc1 100644 --- a/contrib/file/src/apprentice.c +++ b/contrib/file/src/apprentice.c @@ -32,11 +32,10 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: apprentice.c,v 1.168 2011/03/20 20:36:52 christos Exp $") +FILE_RCSID("@(#)$File: apprentice.c,v 1.169 2011/05/10 17:08:13 christos Exp $") #endif /* lint */ #include "magic.h" -#include "patchlevel.h" #include #ifdef HAVE_UNISTD_H #include @@ -2259,8 +2258,8 @@ apprentice_map(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, else version = ptr[1]; if (version != VERSIONNO) { - file_error(ms, 0, "File %d.%d supports only version %d magic " - "files. `%s' is version %d", FILE_VERSION_MAJOR, patchlevel, + file_error(ms, 0, "File %s supports only version %d magic " + "files. `%s' is version %d", VERSION, VERSIONNO, dbname, version); goto error1; } diff --git a/contrib/file/src/file.c b/contrib/file/src/file.c index 25367357ec..e00622062b 100644 --- a/contrib/file/src/file.c +++ b/contrib/file/src/file.c @@ -32,7 +32,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: file.c,v 1.143 2011/03/20 20:36:52 christos Exp $") +FILE_RCSID("@(#)$File: file.c,v 1.144 2011/05/10 17:08:14 christos Exp $") #endif /* lint */ #include "magic.h" @@ -70,8 +70,6 @@ int getopt_long(int argc, char * const *argv, const char *optstring, const struc #include "mygetopt.h" #endif -#include "patchlevel.h" - #ifdef S_IFLNK #define FILE_FLAGS "-bchikLlNnprsvz0" #else @@ -251,8 +249,7 @@ main(int argc, char *argv[]) case 'v': if (magicfile == NULL) magicfile = magic_getpath(magicfile, action); - (void)fprintf(stdout, "%s-%d.%.2d\n", progname, - FILE_VERSION_MAJOR, patchlevel); + (void)fprintf(stdout, "%s-%s\n", progname, VERSION); (void)fprintf(stdout, "magic file from %s\n", magicfile); return 1; diff --git a/contrib/file/src/file_opts.h b/contrib/file/src/file_opts.h index bb8d0a0a5d..8a176721f6 100644 --- a/contrib/file/src/file_opts.h +++ b/contrib/file/src/file_opts.h @@ -33,7 +33,7 @@ OPT_LONGONLY("mime-type", 0, " output the MIME type\n") OPT_LONGONLY("mime-encoding", 0, " output the MIME encoding\n") OPT('k', "keep-going", 0, " don't stop at the first match\n") #ifdef S_IFLNK -OPT('l', "list", 0, " list magic strength\n") +OPT('l', "list", 0, " list magic strength\n") OPT('L', "dereference", 0, " follow symlinks (default)\n") OPT('h', "no-dereference", 0, " don't follow symlinks\n") #endif diff --git a/contrib/file/src/funcs.c b/contrib/file/src/funcs.c index 0e7ff95c54..afacd33c2a 100644 --- a/contrib/file/src/funcs.c +++ b/contrib/file/src/funcs.c @@ -27,7 +27,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: funcs.c,v 1.56 2011/02/03 01:43:33 christos Exp $") +FILE_RCSID("@(#)$File: funcs.c,v 1.57 2011/05/11 01:02:41 christos Exp $") #endif /* lint */ #include "magic.h" @@ -392,9 +392,9 @@ file_getbuffer(struct magic_set *ms) } #endif - for (np = ms->o.pbuf, op = ms->o.buf; *op; op++) { + for (np = ms->o.pbuf, op = ms->o.buf; *op;) { if (isprint((unsigned char)*op)) { - *np++ = *op; + *np++ = *op++; } else { OCTALIFY(np, op); } diff --git a/contrib/file/src/magic.c b/contrib/file/src/magic.c index 06d12390f1..a7f04bba2d 100644 --- a/contrib/file/src/magic.c +++ b/contrib/file/src/magic.c @@ -33,7 +33,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: magic.c,v 1.72 2011/03/20 20:36:52 christos Exp $") +FILE_RCSID("@(#)$File: magic.c,v 1.73 2011/05/10 17:08:14 christos Exp $") #endif /* lint */ #include "magic.h" @@ -62,8 +62,6 @@ FILE_RCSID("@(#)$File: magic.c,v 1.72 2011/03/20 20:36:52 christos Exp $") #include /* for read() */ #endif -#include "patchlevel.h" - #ifndef PIPE_BUF /* Get the PIPE_BUF from pathconf */ #ifdef _PC_PIPE_BUF diff --git a/contrib/file/src/patchlevel.h b/contrib/file/src/patchlevel.h deleted file mode 100644 index 358f81c182..0000000000 --- a/contrib/file/src/patchlevel.h +++ /dev/null @@ -1,358 +0,0 @@ -#define FILE_VERSION_MAJOR 5 -#define patchlevel 5 - -/* - * Patchlevel file for Ian Darwin's MAGIC command. - * $File: patchlevel.h,v 1.76 2011/01/17 16:40:41 christos Exp $ - * - * $Log: patchlevel.h,v $ - * Revision 1.76 2011/01/17 16:40:41 christos - * welcome to 5_05 - * - * Revision 1.75 2010/01/22 21:08:13 christos - * welcome to 5.04 - * - * Revision 1.74 2009/05/06 20:32:48 christos - * welcome to 5.03 - * - * Revision 1.73 2009/05/04 15:15:13 christos - * 5.02... - * - * Revision 1.72 2009/04/30 21:20:15 christos - * 5.01 we are almost here. - * - * Revision 1.71 2009/01/21 19:09:42 christos - * file 5.0 - * - * Revision 1.70 2008/08/30 10:01:01 christos - * file 4.26 - * - * Revision 1.69 2008/07/02 15:27:05 christos - * welcome to 4.25 - * - * Revision 1.68 2008/03/22 21:39:43 christos - * file 4.24 - * - * Revision 1.67 2007/12/28 20:08:40 christos - * welcome to 4.23. - * - * Revision 1.66 2007/12/27 16:38:24 christos - * welcome to 4.22 - * - * Revision 1.65 2007/05/24 17:22:27 christos - * Welcome to 4.21 - * - * Revision 1.64 2007/03/01 22:14:55 christos - * welcome to 4.20 - * - * Revision 1.63 2007/01/12 17:38:28 christos - * Use File id. - * - * Revision 1.62 2006/12/11 21:49:58 christos - * time for 4.19 - * - * Revision 1.61 2006/10/31 21:18:09 christos - * bump - * - * Revision 1.60 2006/03/02 22:15:12 christos - * welcome to 4.17 - * - * Revision 1.59 2005/10/17 17:15:21 christos - * welcome to 4.16 - * - * Revision 1.58 2005/08/18 15:52:56 christos - * welcome to 4.15 - * - * Revision 1.57 2005/06/25 15:52:14 christos - * Welcome to 4.14 - * - * Revision 1.56 2005/02/09 19:25:13 christos - * Welcome to 4.13 - * - * Revision 1.55 2004/11/24 18:57:47 christos - * Re-do the autoconf stuff once more; passes make dist now. - * - * Revision 1.54 2004/11/21 05:52:05 christos - * ready for 4.11 - * - * Revision 1.53 2004/07/24 20:40:46 christos - * welcome to 4.10 - * - * Revision 1.52 2004/04/07 00:32:25 christos - * welcome to 4.09 - * - * Revision 1.51 2004/03/22 21:17:11 christos - * welcome to 4.08. - * - * Revision 1.50 2003/12/23 17:34:04 christos - * 4.07 - * - * Revision 1.49 2003/10/15 02:08:27 christos - * welcome to 4.06 - * - * Revision 1.48 2003/09/12 19:41:14 christos - * this is 4.04 - * - * Revision 1.47 2003/05/23 21:38:21 christos - * welcome to 4.03 - * - * Revision 1.46 2003/04/02 18:57:43 christos - * prepare for 4.02 - * - * Revision 1.45 2003/03/26 15:37:25 christos - * - Pass lint - * - make NULL in magic_file mean stdin - * - Fix "-" argument to file to pass NULL to magic_file - * - avoid pointer casts by using memcpy - * - rename magic_buf -> magic_buffer - * - keep only the first error - * - manual page: new sentence, new line - * - fix typo in api function (magic_buf -> magic_buffer) - * - * Revision 1.44 2003/03/23 22:23:31 christos - * finish librarification. - * - * Revision 1.43 2003/03/23 21:16:26 christos - * update copyrights. - * - * Revision 1.42 2003/03/23 04:06:05 christos - * Library re-organization - * - * Revision 1.41 2003/02/27 20:53:45 christos - * - fix memory allocation problem (Jeff Johnson) - * - fix stack overflow corruption (David Endler) - * - fixes from NetBSD source (Antti Kantee) - * - magic fixes - * - * Revision 1.40 2003/02/08 18:33:53 christos - * - detect inttypes.h too (Dave Love ) - * - eliminate unsigned char warnings (Petter Reinholdtsen ) - * - better elf PT_NOTE handling (Nalin Dahyabhai ) - * - add options to format the output differently - * - much more magic. - * - * Revision 1.39 2002/07/03 18:57:52 christos - * - ansify/c99ize - * - more magic - * - better COMPILE_ONLY support. - * - new magic files. - * - fix solaris compilation problems. - * - * Revision 1.38 2002/05/16 18:45:56 christos - * - pt_note elf additions from NetBSD - * - EMX os specific changes (Alexander Mai) - * - stdint.h detection, acconfig.h fixes (Maciej W. Rozycki, Franz Korntner) - * - regex file additions (Kim Cromie) - * - getopt_long support and misc cleanups (Michael Piefel) - * - many magic fixes and additions - * - * Revision 1.37 2001/09/03 14:44:22 christos - * daylight/tm_isdst detection - * magic fixes - * don't eat the whole file if it has only nulls - * - * Revision 1.36 2001/07/22 21:04:15 christos - * - magic fixes - * - add new operators, pascal strings, UTC date printing, $HOME/.magic - * [from "Tom N Harris" ] - * - * Revision 1.35 2001/04/24 14:40:25 christos - * - rename magic file sgi to mips and fix it - * - add support for building magic.mgc - * - portability fixes for mmap() - * - try gzip before uncompress, because uncompress sometimes hangs - * - be more conservative about pipe reads and writes - * - many magic fixes - * - * Revision 1.34 2001/03/12 05:05:57 christos - * - new compiled magic format - * - lots of magic additions - * - * Revision 1.33 2000/11/13 00:30:50 christos - * - wordperfect magic fix: freebsd pr 9388 - * - more msdos fixes from freebsd pr's 20131 and 20812 - * - sas and spss magic [Bruce Foster] - * - mkinstalldirs [John Fremlin] - * - sgi opengl fixes [Michael Pruett] - * - netbsd magic fixes [Ignatios Souvatzis] - * - audio additions [Michael Pruett] - * - fix problem with non ansi RCSID [Andreas Ley] - * - oggs magic [Felix von Leitner] - * - gmon magic [Eugen Dedu] - * - TNEF magic [Joomy] - * - netpbm magic and misc other image stuff [Bryan Henderson] - * - * Revision 1.32 2000/08/05 18:24:18 christos - * Correct indianness detection in elf (Charles Hannum) - * FreeBSD elf core support (Guy Harris) - * Use gzip in systems that don't have uncompress (Anthon van der Neut) - * Internationalization/EBCDIC support (Eric Fisher) - * Many many magic changes - * - * Revision 1.31 2000/05/14 17:58:36 christos - * - new magic for claris files - * - new magic for mathematica and maple files - * - new magic for msvc files - * - new -k flag to keep going matching all possible entries - * - add the word executable on #! magic files, and fix the usage of - * the word script - * - lots of other magic fixes - * - fix typo test -> text - * - * Revision 1.30 2000/04/11 02:41:17 christos - * - add support for mime output (-i) - * - make sure we free memory in case realloc fails - * - magic fixes - * - * Revision 1.29 1999/11/28 20:02:29 christos - * new string/[Bcb] magic from anthon, and adjustments to the magic files to - * use it. - * - * Revision 1.28 1999/10/31 22:11:48 christos - * - add "char" type for compatibility with HP/UX - * - recognize HP/UX syntax &=n etc. - * - include errno.h for CYGWIN - * - conditionalize the S_IS* macros - * - revert the SHT_DYNSYM test that broke the linux stripped binaries test - * - lots of Magdir changes - * - * Revision 1.27 1999/02/14 17:21:41 christos - * Automake support and misc cleanups from Rainer Orth - * Enable reading character and block special files from Dale R. Worley - * - * Revision 1.26 1998/09/12 13:19:39 christos - * - add support for bi-endian indirect offsets (Richard Verhoeven) - * - add recognition for bcpl (Joseph Myers) - * - remove non magic files from Magdir to avoid difficulties building - * on os2 where files are case independent - * - magic fixes. - * - * Revision 1.25 1998/06/27 14:04:04 christos - * OLF patch Guy Harris - * Recognize java/html (debian linux) - * Const poisoning (debian linux) - * More magic! - * - * Revision 1.24 1998/02/15 23:20:38 christos - * Autoconf patch: Felix von Leitner - * More magic fixes - * Elf64 fixes - * - * Revision 1.23 1997/11/05 16:03:37 christos - * - correct elf prps offset for SunOS-2.5.1 [guy@netapp.com] - * - handle 64 bit time_t's correctly [ewt@redhat.com] - * - new mime style magic [clarosse@netvista.net] - * - new TI calculator magic [rmcguire@freenet.columbus.oh.us] - * - new figlet fonts [obrien@freebsd.org] - * - new cisco magic, and elf fixes [jhawk@bbnplanet.com] - * - -b flag addition, and x86 filesystem magic [vax@linkhead.paranoia.com] - * - s/Mpeg/MPEG, header and elf typo fixes [guy@netapp.com] - * - Windows/NT registry files, audio code [guy@netapp.com] - * - libGrx graphics lib fonts [guy@netapp.com] - * - PNG fixes [guy@netapp.com] - * - more m$ document magic [guy@netapp.com] - * - PPD files [guy@netapp.com] - * - archive magic cleanup [guy@netapp.com] - * - linux kernel magic cleanup [guy@netapp.com] - * - lecter magic [guy@netapp.com] - * - vgetty magic [guy@netapp.com] - * - sniffer additions [guy@netapp.com] - * - * Revision 1.22 1997/01/15 17:23:24 christos - * - add support for elf core files: find the program name under SVR4 [Ken Pizzini] - * - print strings only up to the first carriage return [various] - * - freebsd international ascii support [J Wunsch] - * - magic fixes and additions [Guy Harris] - * - 64 bit fixes [Larry Schwimmer] - * - support for both utime and utimes, but don't restore file access times - * by default [various] - * - \xXX only takes 2 hex digits, not 3. - * - re-implement support for core files [Guy Harris] - * - * Revision 1.21 1996/10/05 18:15:29 christos - * Segregate elf stuff and conditionally enable it with -DBUILTIN_ELF - * More magic fixes - * - * Revision 1.20 1996/06/22 22:15:52 christos - * - support relative offsets of the form >& - * - fix bug with truncating magic strings that contain \n - * - file -f - did not read from stdin as documented - * - support elf file parsing using our own elf support. - * - as always magdir fixes and additions. - * - * Revision 1.19 1995/10/27 23:14:46 christos - * Ability to parse colon separated list of magic files - * New LEGAL.NOTICE - * Various magic file changes - * - * Revision 1.18 1995/05/20 22:09:21 christos - * Passed incorrect argument to eatsize(). - * Use %ld and %lx where appropriate. - * Remove unused variables - * ELF support for both big and little endian - * Fixes for small files again. - * - * Revision 1.17 1995/04/28 17:29:13 christos - * - Incorrect nroff detection fix from der Mouse - * - Lost and incorrect magic entries. - * - Added ELF stripped binary detection [in C; ugh] - * - Look for $MAGIC to find the magic file. - * - Eat trailing size specifications from numbers i.e. ignore 10L - * - More fixes for very short files - * - * Revision 1.16 1995/03/25 22:06:45 christos - * - use strtoul() where it exists. - * - fix sign-extend bug - * - try to detect tar archives before nroff files, otherwise - * tar files where the first file starts with a . will not work - * - * Revision 1.15 1995/01/21 21:03:35 christos - * Added CSECTION for the file man page - * Added version flag -v - * Fixed bug with -f input flag (from iorio@violet.berkeley.edu) - * Lots of magic fixes and reorganization... - * - * Revision 1.14 1994/05/03 17:58:23 christos - * changes from mycroft@gnu.ai.mit.edu (Charles Hannum) for unsigned - * - * Revision 1.13 1994/01/21 01:27:01 christos - * Fixed null termination bug from Don Seeley at BSDI in ascmagic.c - * - * Revision 1.12 1993/10/27 20:59:05 christos - * Changed -z flag to understand gzip format too. - * Moved builtin compression detection to a table, and move - * the compress magic entry out of the source. - * Made printing of numbers unsigned, and added the mask to it. - * Changed the buffer size to 8k, because gzip will refuse to - * unzip just a few bytes. - * - * Revision 1.11 1993/09/24 18:49:06 christos - * Fixed small bug in softmagic.c introduced by - * copying the data to be examined out of the input - * buffer. Changed the Makefile to use sed to create - * the correct man pages. - * - * Revision 1.10 1993/09/23 21:56:23 christos - * Passed purify. Fixed indirections. Fixed byte order printing. - * Fixed segmentation faults caused by referencing past the end - * of the magic buffer. Fixed bus errors caused by referencing - * unaligned shorts or longs. - * - * Revision 1.9 1993/03/24 14:23:40 ian - * Batch of minor changes from several contributors. - * - * Revision 1.8 93/02/19 15:01:26 ian - * Numerous changes from Guy Harris too numerous to mention but including - * byte-order independance, fixing "old-style masking", etc. etc. A bugfix - * for broken symlinks from martin@@d255s004.zfe.siemens.de. - * - * Revision 1.7 93/01/05 14:57:27 ian - * Couple of nits picked by Christos (again, thanks). - * - * Revision 1.6 93/01/05 13:51:09 ian - * Lotsa work on the Magic directory. - * - * Revision 1.5 92/09/14 14:54:51 ian - * Fix a tiny null-pointer bug in previous fix for tar archive + uncompress. - * - */