MFV r288140: update file to 5.25.
MFC after: 1 month
This commit is contained in:
@@ -1,3 +1,19 @@
|
|||||||
|
2015-09-16 9:50 Christos Zoulas <christos@zoulas.com>
|
||||||
|
|
||||||
|
* release 5.25
|
||||||
|
|
||||||
|
2015-09-11 13:25 Christos Zoulas <christos@zoulas.com>
|
||||||
|
|
||||||
|
* add a limit to the length of regex searches
|
||||||
|
|
||||||
|
2015-09-08 9:50 Christos Zoulas <christos@zoulas.com>
|
||||||
|
|
||||||
|
* fix problems with --parameter (Christoph Biedl)
|
||||||
|
|
||||||
|
2015-07-11 10:35 Christos Zoulas <christos@zoulas.com>
|
||||||
|
|
||||||
|
* Windows fixes PR/466 (Jason Hood)
|
||||||
|
|
||||||
2015-07-09 10:35 Christos Zoulas <christos@zoulas.com>
|
2015-07-09 10:35 Christos Zoulas <christos@zoulas.com>
|
||||||
|
|
||||||
* release 5.24
|
* release 5.24
|
||||||
|
|||||||
Vendored
+10
-10
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Guess values for system-dependent variables and create Makefiles.
|
# Guess values for system-dependent variables and create Makefiles.
|
||||||
# Generated by GNU Autoconf 2.69 for file 5.24.
|
# Generated by GNU Autoconf 2.69 for file 5.25.
|
||||||
#
|
#
|
||||||
# Report bugs to <christos@astron.com>.
|
# Report bugs to <christos@astron.com>.
|
||||||
#
|
#
|
||||||
@@ -590,8 +590,8 @@ MAKEFLAGS=
|
|||||||
# Identity of this package.
|
# Identity of this package.
|
||||||
PACKAGE_NAME='file'
|
PACKAGE_NAME='file'
|
||||||
PACKAGE_TARNAME='file'
|
PACKAGE_TARNAME='file'
|
||||||
PACKAGE_VERSION='5.24'
|
PACKAGE_VERSION='5.25'
|
||||||
PACKAGE_STRING='file 5.24'
|
PACKAGE_STRING='file 5.25'
|
||||||
PACKAGE_BUGREPORT='christos@astron.com'
|
PACKAGE_BUGREPORT='christos@astron.com'
|
||||||
PACKAGE_URL=''
|
PACKAGE_URL=''
|
||||||
|
|
||||||
@@ -1327,7 +1327,7 @@ if test "$ac_init_help" = "long"; then
|
|||||||
# Omit some internal or obsolete options to make the list less imposing.
|
# Omit some internal or obsolete options to make the list less imposing.
|
||||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||||
cat <<_ACEOF
|
cat <<_ACEOF
|
||||||
\`configure' configures file 5.24 to adapt to many kinds of systems.
|
\`configure' configures file 5.25 to adapt to many kinds of systems.
|
||||||
|
|
||||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||||
|
|
||||||
@@ -1397,7 +1397,7 @@ fi
|
|||||||
|
|
||||||
if test -n "$ac_init_help"; then
|
if test -n "$ac_init_help"; then
|
||||||
case $ac_init_help in
|
case $ac_init_help in
|
||||||
short | recursive ) echo "Configuration of file 5.24:";;
|
short | recursive ) echo "Configuration of file 5.25:";;
|
||||||
esac
|
esac
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
|
|
||||||
@@ -1507,7 +1507,7 @@ fi
|
|||||||
test -n "$ac_init_help" && exit $ac_status
|
test -n "$ac_init_help" && exit $ac_status
|
||||||
if $ac_init_version; then
|
if $ac_init_version; then
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
file configure 5.24
|
file configure 5.25
|
||||||
generated by GNU Autoconf 2.69
|
generated by GNU Autoconf 2.69
|
||||||
|
|
||||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||||
@@ -2163,7 +2163,7 @@ cat >config.log <<_ACEOF
|
|||||||
This file contains any messages produced by compilers while
|
This file contains any messages produced by compilers while
|
||||||
running configure, to aid debugging if configure makes a mistake.
|
running configure, to aid debugging if configure makes a mistake.
|
||||||
|
|
||||||
It was created by file $as_me 5.24, which was
|
It was created by file $as_me 5.25, which was
|
||||||
generated by GNU Autoconf 2.69. Invocation command line was
|
generated by GNU Autoconf 2.69. Invocation command line was
|
||||||
|
|
||||||
$ $0 $@
|
$ $0 $@
|
||||||
@@ -3029,7 +3029,7 @@ fi
|
|||||||
|
|
||||||
# Define the identity of the package.
|
# Define the identity of the package.
|
||||||
PACKAGE='file'
|
PACKAGE='file'
|
||||||
VERSION='5.24'
|
VERSION='5.25'
|
||||||
|
|
||||||
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
cat >>confdefs.h <<_ACEOF
|
||||||
@@ -15036,7 +15036,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
|||||||
# report actual input values of CONFIG_FILES etc. instead of their
|
# report actual input values of CONFIG_FILES etc. instead of their
|
||||||
# values after options handling.
|
# values after options handling.
|
||||||
ac_log="
|
ac_log="
|
||||||
This file was extended by file $as_me 5.24, which was
|
This file was extended by file $as_me 5.25, which was
|
||||||
generated by GNU Autoconf 2.69. Invocation command line was
|
generated by GNU Autoconf 2.69. Invocation command line was
|
||||||
|
|
||||||
CONFIG_FILES = $CONFIG_FILES
|
CONFIG_FILES = $CONFIG_FILES
|
||||||
@@ -15102,7 +15102,7 @@ _ACEOF
|
|||||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||||
ac_cs_version="\\
|
ac_cs_version="\\
|
||||||
file config.status 5.24
|
file config.status 5.25
|
||||||
configured by $0, generated by GNU Autoconf 2.69,
|
configured by $0, generated by GNU Autoconf 2.69,
|
||||||
with options \\"\$ac_cs_config\\"
|
with options \\"\$ac_cs_config\\"
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
AC_INIT([file],[5.24],[christos@astron.com])
|
AC_INIT([file],[5.25],[christos@astron.com])
|
||||||
AM_INIT_AUTOMAKE([subdir-objects foreign])
|
AM_INIT_AUTOMAKE([subdir-objects foreign])
|
||||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
.\" $File: file.man,v 1.117 2015/06/03 19:51:27 christos Exp $
|
.\" $File: file.man,v 1.118 2015/09/11 17:24:09 christos Exp $
|
||||||
.Dd June 3, 2015
|
.Dd September 11, 2015
|
||||||
.Dt FILE __CSECTION__
|
.Dt FILE __CSECTION__
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@@ -316,6 +316,7 @@ Set various parameter limits.
|
|||||||
.It Li elf_notes Ta 256 Ta max ELF notes processed
|
.It Li elf_notes Ta 256 Ta max ELF notes processed
|
||||||
.It Li elf_phnum Ta 128 Ta max ELF program sections processed
|
.It Li elf_phnum Ta 128 Ta max ELF program sections processed
|
||||||
.It Li elf_shnum Ta 32768 Ta max ELF sections processed
|
.It Li elf_shnum Ta 32768 Ta max ELF sections processed
|
||||||
|
.It Li regex Ta 8192 Ta length limit for regex searches
|
||||||
.El
|
.El
|
||||||
.It Fl r , Fl Fl raw
|
.It Fl r , Fl Fl raw
|
||||||
Don't translate unprintable characters to \eooo.
|
Don't translate unprintable characters to \eooo.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.\" $File: libmagic.man,v 1.37 2015/06/03 18:21:24 christos Exp $
|
.\" $File: libmagic.man,v 1.38 2015/09/11 17:24:09 christos Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) Christos Zoulas 2003.
|
.\" Copyright (c) Christos Zoulas 2003.
|
||||||
.\" All Rights Reserved.
|
.\" All Rights Reserved.
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd June 3, 2015
|
.Dd September 11, 2015
|
||||||
.Dt LIBMAGIC 3
|
.Dt LIBMAGIC 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@@ -291,6 +291,7 @@ library.
|
|||||||
.It Li MAGIC_PARAM_ELF_NOTES_MAX Ta size_t Ta 256
|
.It Li MAGIC_PARAM_ELF_NOTES_MAX Ta size_t Ta 256
|
||||||
.It Li MAGIC_PARAM_ELF_PHNUM_MAX Ta size_t Ta 128
|
.It Li MAGIC_PARAM_ELF_PHNUM_MAX Ta size_t Ta 128
|
||||||
.It Li MAGIC_PARAM_ELF_SHNUM_MAX Ta size_t Ta 32768
|
.It Li MAGIC_PARAM_ELF_SHNUM_MAX Ta size_t Ta 32768
|
||||||
|
.It Li MAGIC_PARAM_REGEX_MAX Ta size_t Ta 8192
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
The
|
The
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.\" $File: magic.man,v 1.85 2015/01/01 17:07:34 christos Exp $
|
.\" $File: magic.man,v 1.86 2015/09/08 13:48:44 christos Exp $
|
||||||
.Dd January 1, 2015
|
.Dd January 1, 2015
|
||||||
.Dt MAGIC __FSECTION__
|
.Dt MAGIC __FSECTION__
|
||||||
.Os
|
.Os
|
||||||
@@ -200,7 +200,7 @@ interpreted as a UNIX-style date, but interpreted as local time rather
|
|||||||
than UTC.
|
than UTC.
|
||||||
.It Dv indirect
|
.It Dv indirect
|
||||||
Starting at the given offset, consult the magic database again.
|
Starting at the given offset, consult the magic database again.
|
||||||
The offset of th
|
The offset of the
|
||||||
.Dv indirect
|
.Dv indirect
|
||||||
magic is by default absolute in the file, but one can specify
|
magic is by default absolute in the file, but one can specify
|
||||||
.Dv /r
|
.Dv /r
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# $File: adventure,v 1.14 2012/06/21 01:32:26 christos Exp $
|
# $File: adventure,v 1.15 2015/09/07 10:03:21 christos Exp $
|
||||||
# adventure: file(1) magic for Adventure game files
|
# adventure: file(1) magic for Adventure game files
|
||||||
#
|
#
|
||||||
# from Allen Garvin <earendil@faeryland.tamu-commerce.edu>
|
# from Allen Garvin <earendil@faeryland.tamu-commerce.edu>
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
# Infocom (see z-machine)
|
# Infocom (see z-machine)
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Z-machine: file(1) magic for Z-machine binaries.
|
# Z-machine: file(1) magic for Z-machine binaries.
|
||||||
|
# Sanity checks by David Griffith <dave@661.org>
|
||||||
# Updated by Adam Buchbinder <adam.buchbinder@gmail.com>
|
# Updated by Adam Buchbinder <adam.buchbinder@gmail.com>
|
||||||
#
|
#
|
||||||
#http://www.gnelson.demon.co.uk/zspec/sect11.html
|
#http://www.gnelson.demon.co.uk/zspec/sect11.html
|
||||||
@@ -41,10 +42,12 @@
|
|||||||
>>>>>>>2 ubeshort < 10 Release %d /
|
>>>>>>>2 ubeshort < 10 Release %d /
|
||||||
>>>>>>>>18 string >\0 Serial %.6s)
|
>>>>>>>>18 string >\0 Serial %.6s)
|
||||||
!:strength + 40
|
!:strength + 40
|
||||||
|
!:mime application/x-zmachine
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Glulx: file(1) magic for Glulx binaries.
|
# Glulx: file(1) magic for Glulx binaries.
|
||||||
#
|
#
|
||||||
|
# David Griffith <dave@661.org>
|
||||||
# I haven't checked for false matches yet.
|
# I haven't checked for false matches yet.
|
||||||
#
|
#
|
||||||
0 string Glul Glulx game data
|
0 string Glul Glulx game data
|
||||||
@@ -52,7 +55,7 @@
|
|||||||
>>6 byte x \b.%d
|
>>6 byte x \b.%d
|
||||||
>>8 byte x \b.%d)
|
>>8 byte x \b.%d)
|
||||||
>36 string Info Compiled by Inform
|
>36 string Info Compiled by Inform
|
||||||
|
!:mime application/x-glulx
|
||||||
|
|
||||||
|
|
||||||
# For Quetzal and blorb magic see iff
|
# For Quetzal and blorb magic see iff
|
||||||
@@ -66,11 +69,13 @@
|
|||||||
>9 belong !0x0A0D1A00 game data, CORRUPTED
|
>9 belong !0x0A0D1A00 game data, CORRUPTED
|
||||||
>9 belong 0x0A0D1A00
|
>9 belong 0x0A0D1A00
|
||||||
>>13 string >\0 %s game data
|
>>13 string >\0 %s game data
|
||||||
|
!:mime application/x-tads
|
||||||
# Resource files start with "TADS2 rsc\n\r\032\0" then the compiler version.
|
# Resource files start with "TADS2 rsc\n\r\032\0" then the compiler version.
|
||||||
0 string TADS2\ rsc TADS
|
0 string TADS2\ rsc TADS
|
||||||
>9 belong !0x0A0D1A00 resource data, CORRUPTED
|
>9 belong !0x0A0D1A00 resource data, CORRUPTED
|
||||||
>9 belong 0x0A0D1A00
|
>9 belong 0x0A0D1A00
|
||||||
>>13 string >\0 %s resource data
|
>>13 string >\0 %s resource data
|
||||||
|
!:mime application/x-tads
|
||||||
# Some saved game files start with "TADS2 save/g\n\r\032\0", a little-endian
|
# Some saved game files start with "TADS2 save/g\n\r\032\0", a little-endian
|
||||||
# 2-byte length N, the N-char name of the game file *without* a NUL (darn!),
|
# 2-byte length N, the N-char name of the game file *without* a NUL (darn!),
|
||||||
# "TADS2 save\n\r\032\0" and the interpreter version.
|
# "TADS2 save\n\r\032\0" and the interpreter version.
|
||||||
@@ -78,12 +83,14 @@
|
|||||||
>12 belong !0x0A0D1A00 saved game data, CORRUPTED
|
>12 belong !0x0A0D1A00 saved game data, CORRUPTED
|
||||||
>12 belong 0x0A0D1A00
|
>12 belong 0x0A0D1A00
|
||||||
>>(16.s+32) string >\0 %s saved game data
|
>>(16.s+32) string >\0 %s saved game data
|
||||||
|
!:mime application/x-tads
|
||||||
# Other saved game files start with "TADS2 save\n\r\032\0" and the interpreter
|
# Other saved game files start with "TADS2 save\n\r\032\0" and the interpreter
|
||||||
# version.
|
# version.
|
||||||
0 string TADS2\ save TADS
|
0 string TADS2\ save TADS
|
||||||
>10 belong !0x0A0D1A00 saved game data, CORRUPTED
|
>10 belong !0x0A0D1A00 saved game data, CORRUPTED
|
||||||
>10 belong 0x0A0D1A00
|
>10 belong 0x0A0D1A00
|
||||||
>>14 string >\0 %s saved game data
|
>>14 string >\0 %s saved game data
|
||||||
|
!:mime application/x-tads
|
||||||
|
|
||||||
# TADS (Text Adventure Development System) version 3
|
# TADS (Text Adventure Development System) version 3
|
||||||
# Game files start with "T3-image\015\012\032"
|
# Game files start with "T3-image\015\012\032"
|
||||||
@@ -97,14 +104,18 @@
|
|||||||
>>11 byte x \b%c
|
>>11 byte x \b%c
|
||||||
>>12 byte x \b%c
|
>>12 byte x \b%c
|
||||||
>>13 byte x \b%c)
|
>>13 byte x \b%c)
|
||||||
|
!:mime application/x-t3vm-image
|
||||||
|
|
||||||
|
# edited by David Griffith <dave@661.org>
|
||||||
# Danny Milosavljevic <danny.milo@gmx.net>
|
# Danny Milosavljevic <danny.milo@gmx.net>
|
||||||
# this are adrift (adventure game standard) game files, extension .taf
|
# These are ADRIFT (adventure game standard) game files, extension .taf
|
||||||
# depending on version magic continues with 0x93453E6139FA (V 4.0)
|
# Checked from source at (http://www.adrift.co/) and various taf files
|
||||||
# 0x9445376139FA (V 3.90)
|
# found at the Interactive Fiction Archive (http://ifarchive.org/)
|
||||||
# 0x9445366139FA (V 3.80)
|
0 belong 0x3C423FC9
|
||||||
# this is from source (http://www.adrift.org.uk/) and I have some taf
|
>4 belong 0x6A87C2CF Adrift game file version
|
||||||
# files, and checked them.
|
>>8 belong 0x94453661 3.80
|
||||||
#0 belong 0x3C423FC9
|
>>8 belong 0x94453761 3.90
|
||||||
#>4 belong 0x6A87C2CF Adrift game file
|
>>8 belong 0x93453E61 4.0
|
||||||
#!:mime application/x-adrift
|
>>8 belong 0x92453E61 5.0
|
||||||
|
>>8 default x unknown
|
||||||
|
!:mime application/x-adrift
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# $File: apple,v 1.30 2015/04/13 13:09:06 christos Exp $
|
# $File: apple,v 1.31 2015/08/29 07:10:35 christos Exp $
|
||||||
# apple: file(1) magic for Apple file formats
|
# apple: file(1) magic for Apple file formats
|
||||||
#
|
#
|
||||||
0 search/1/t FiLeStArTfIlEsTaRt binscii (apple ][) text
|
0 search/1/t FiLeStArTfIlEsTaRt binscii (apple ][) text
|
||||||
@@ -265,14 +265,14 @@
|
|||||||
>>20 beshort x \b, descriptors %d
|
>>20 beshort x \b, descriptors %d
|
||||||
# Assume 8 partitions each at a multiple of the sector size.
|
# Assume 8 partitions each at a multiple of the sector size.
|
||||||
# We could glean this from the partition descriptors, but they are empty!?!?
|
# We could glean this from the partition descriptors, but they are empty!?!?
|
||||||
>>(2.S*1) indirect \b, contains[@0x%x]:
|
>>(2.S*1) indirect x \b, contains[@0x%x]:
|
||||||
>>(2.S*2) indirect \b, contains[@0x%x]:
|
>>(2.S*2) indirect x \b, contains[@0x%x]:
|
||||||
>>(2.S*3) indirect \b, contains[@0x%x]:
|
>>(2.S*3) indirect x \b, contains[@0x%x]:
|
||||||
>>(2.S*4) indirect \b, contains[@0x%x]:
|
>>(2.S*4) indirect x \b, contains[@0x%x]:
|
||||||
>>(2.S*5) indirect \b, contains[@0x%x]:
|
>>(2.S*5) indirect x \b, contains[@0x%x]:
|
||||||
>>(2.S*6) indirect \b, contains[@0x%x]:
|
>>(2.S*6) indirect x \b, contains[@0x%x]:
|
||||||
>>(2.S*7) indirect \b, contains[@0x%x]:
|
>>(2.S*7) indirect x \b, contains[@0x%x]:
|
||||||
>>(2.S*8) indirect \b, contains[@0x%x]:
|
>>(2.S*8) indirect x \b, contains[@0x%x]:
|
||||||
|
|
||||||
# Yes, the 3rd and 4th bytes are reserved, but we use them to make the
|
# Yes, the 3rd and 4th bytes are reserved, but we use them to make the
|
||||||
# magic stronger.
|
# magic stronger.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# $File: archive,v 1.90 2015/04/24 15:44:12 christos Exp $
|
# $File: archive,v 1.91 2015/09/16 13:49:33 christos Exp $
|
||||||
# archive: file(1) magic for archive formats (see also "msdos" for self-
|
# archive: file(1) magic for archive formats (see also "msdos" for self-
|
||||||
# extracting compressed archives)
|
# extracting compressed archives)
|
||||||
#
|
#
|
||||||
@@ -434,16 +434,34 @@
|
|||||||
# AIN
|
# AIN
|
||||||
0 string \x33\x18 AIN archive data
|
0 string \x33\x18 AIN archive data
|
||||||
0 string \x33\x17 AIN archive data
|
0 string \x33\x17 AIN archive data
|
||||||
# XPA32
|
# XPA32 test moved and merged with XPA by Joerg Jenderek at Sep 2015
|
||||||
0 string xpa\0\1 XPA32 archive data
|
|
||||||
# SZip (TODO: doesn't catch all versions)
|
# SZip (TODO: doesn't catch all versions)
|
||||||
0 string SZ\x0a\4 SZip archive data
|
0 string SZ\x0a\4 SZip archive data
|
||||||
# XPack DiskImage
|
# XPack DiskImage
|
||||||
0 string jm XPack DiskImage archive data
|
# *.XDI updated by Joerg Jenderek Sep 2015
|
||||||
|
# ftp://ftp.sac.sk/pub/sac/pack/0index.txt
|
||||||
|
# GRR: this test is still too general as it catches also text files starting with jm
|
||||||
|
0 string jm
|
||||||
|
# only found examples with this additional characteristic 2 bytes
|
||||||
|
>2 string \x2\x4 Xpack DiskImage archive data
|
||||||
|
#!:ext xdi
|
||||||
# XPack Data
|
# XPack Data
|
||||||
0 string xpa XPack archive data
|
# *.xpa updated by Joerg Jenderek Sep 2015
|
||||||
|
# ftp://ftp.elf.stuba.sk/pub/pc/pack/
|
||||||
|
0 string xpa XPA
|
||||||
|
!:ext xpa
|
||||||
|
# XPA32
|
||||||
|
# ftp://ftp.elf.stuba.sk/pub/pc/pack/xpa32.zip
|
||||||
|
# created by XPA32.EXE version 1.0.2 for Windows
|
||||||
|
>0 string xpa\0\1 \b32 archive data
|
||||||
|
# created by XPACK.COM version 1.67m or 1.67r with short 0x1800
|
||||||
|
>3 ubeshort !0x0001 \bck archive data
|
||||||
# XPack Single Data
|
# XPack Single Data
|
||||||
0 string \xc3\x8d\ jm XPack single archive data
|
# changed by Joerg Jenderek Sep 2015 back to like in version 5.12
|
||||||
|
# letter 'I'+ acute accent is equivalent to \xcd
|
||||||
|
0 string \xcd\ jm Xpack single archive data
|
||||||
|
#!:mime application/x-xpa-compressed
|
||||||
|
!:ext xpa
|
||||||
|
|
||||||
# TODO: missing due to unknown magic/magic at end of file:
|
# TODO: missing due to unknown magic/magic at end of file:
|
||||||
#DWC
|
#DWC
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# $File: c-lang,v 1.19 2014/06/03 19:17:27 christos Exp $
|
# $File: c-lang,v 1.20 2015/07/27 14:33:10 christos Exp $
|
||||||
# c-lang: file(1) magic for C and related languages programs
|
# c-lang: file(1) magic for C and related languages programs
|
||||||
#
|
#
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
# C++
|
# C++
|
||||||
# The strength of these rules is increased so they beat the C rules above
|
# The strength of these rules is increased so they beat the C rules above
|
||||||
0 regex \^template[\ \t\n]+ C++ source text
|
0 regex \^template[\ \t]+<.*>[\ \t\n]+ C++ source text
|
||||||
!:strength + 5
|
!:strength + 5
|
||||||
!:mime text/x-c++
|
!:mime text/x-c++
|
||||||
0 regex \^virtual[\ \t\n]+ C++ source text
|
0 regex \^virtual[\ \t\n]+ C++ source text
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# $File: c64,v 1.5 2009/09/19 16:28:08 christos Exp $
|
# $File: c64,v 1.6 2015/08/24 05:17:42 christos Exp $
|
||||||
# c64: file(1) magic for various commodore 64 related files
|
# c64: file(1) magic for various commodore 64 related files
|
||||||
#
|
#
|
||||||
# From: Dirk Jagdmann <doj@cubic.org>
|
# From: Dirk Jagdmann <doj@cubic.org>
|
||||||
@@ -41,3 +41,9 @@
|
|||||||
>32 leshort x Version:0x%x
|
>32 leshort x Version:0x%x
|
||||||
>36 leshort !0 Entries:%i
|
>36 leshort !0 Entries:%i
|
||||||
>40 string x Name:%.24s
|
>40 string x Name:%.24s
|
||||||
|
|
||||||
|
# Raw tape file format (.tap files)
|
||||||
|
# Esa Hyyti <esa@netlab.tkk.fi>
|
||||||
|
0 string C64-TAPE-RAW C64 Raw Tape File (.tap),
|
||||||
|
>0x0c byte x Version:%u,
|
||||||
|
>0x10 lelong x Length:%u cycles
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# $File: compress,v 1.63 2015/03/11 19:27:35 christos Exp $
|
# $File: compress,v 1.64 2015/07/27 15:41:09 christos Exp $
|
||||||
# compress: file(1) magic for pure-compression formats (no archives)
|
# compress: file(1) magic for pure-compression formats (no archives)
|
||||||
#
|
#
|
||||||
# compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc.
|
# compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc.
|
||||||
@@ -258,7 +258,8 @@
|
|||||||
!:mime application/x-qpress
|
!:mime application/x-qpress
|
||||||
|
|
||||||
# Zlib https://www.ietf.org/rfc/rfc6713.txt
|
# Zlib https://www.ietf.org/rfc/rfc6713.txt
|
||||||
0 beshort%31 =0
|
0 string/b x
|
||||||
>0 byte&0xf =8
|
>0 beshort%31 =0
|
||||||
>>0 byte&0x80 =0 zlib compressed data
|
>>0 byte&0xf =8
|
||||||
|
>>>0 byte&0x80 =0 zlib compressed data
|
||||||
!:mime application/zlib
|
!:mime application/zlib
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# $File: database,v 1.44 2015/07/02 18:25:57 christos Exp $
|
# $File: database,v 1.45 2015/09/09 16:25:29 christos Exp $
|
||||||
# database: file(1) magic for various databases
|
# database: file(1) magic for various databases
|
||||||
#
|
#
|
||||||
# extracted from header/code files by Graeme Wilford (eep2gw@ee.surrey.ac.uk)
|
# extracted from header/code files by Graeme Wilford (eep2gw@ee.surrey.ac.uk)
|
||||||
@@ -541,3 +541,7 @@
|
|||||||
|
|
||||||
# IDA (Interactive Disassembler) database
|
# IDA (Interactive Disassembler) database
|
||||||
0 string IDA1 IDA (Interactive Disassembler) database
|
0 string IDA1 IDA (Interactive Disassembler) database
|
||||||
|
|
||||||
|
# Hopper (reverse engineering tool) http://www.hopperapp.com/
|
||||||
|
0 string hopperdb Hopper database
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# $File: filesystems,v 1.109 2015/02/22 01:22:54 christos Exp $
|
# $File: filesystems,v 1.111 2015/09/09 16:26:54 christos Exp $
|
||||||
# filesystems: file(1) magic for different filesystems
|
# filesystems: file(1) magic for different filesystems
|
||||||
#
|
#
|
||||||
0 name partid
|
0 name partid
|
||||||
@@ -1721,7 +1721,7 @@
|
|||||||
0x410 leshort 0x137f
|
0x410 leshort 0x137f
|
||||||
!:strength / 2
|
!:strength / 2
|
||||||
>0x402 beshort < 100
|
>0x402 beshort < 100
|
||||||
>0x402 beshort > -1 Minix filesystem, V1, %d zones
|
>0x402 beshort > -1 Minix filesystem, V1, 14 char names, %d zones
|
||||||
>0x1e string minix \b, bootable
|
>0x1e string minix \b, bootable
|
||||||
0x410 beshort 0x137f
|
0x410 beshort 0x137f
|
||||||
!:strength / 2
|
!:strength / 2
|
||||||
@@ -1740,27 +1740,26 @@
|
|||||||
>0x1e string minix \b, bootable
|
>0x1e string minix \b, bootable
|
||||||
0x410 leshort 0x2468
|
0x410 leshort 0x2468
|
||||||
>0x402 beshort < 100
|
>0x402 beshort < 100
|
||||||
>>0x402 beshort > -1 Minix filesystem, V2, %d zones
|
>>0x402 beshort > -1 Minix filesystem, V2, 14 char names
|
||||||
>0x1e string minix \b, bootable
|
>0x1e string minix \b, bootable
|
||||||
0x410 beshort 0x2468
|
0x410 beshort 0x2468
|
||||||
>0x402 beshort < 100
|
>0x402 beshort < 100
|
||||||
>0x402 beshort > -1 Minix filesystem, V2 (big endian), %d zones
|
>0x402 beshort > -1 Minix filesystem, V2 (big endian)
|
||||||
>0x1e string minix \b, bootable
|
|
||||||
|
|
||||||
0x410 leshort 0x2478
|
|
||||||
>0x402 beshort < 100
|
|
||||||
>0x402 beshort > -1 Minix filesystem, V2, 30 char names, %d zones
|
|
||||||
>0x1e string minix \b, bootable
|
>0x1e string minix \b, bootable
|
||||||
0x410 leshort 0x2478
|
0x410 leshort 0x2478
|
||||||
>0x402 beshort < 100
|
>0x402 beshort < 100
|
||||||
>0x402 beshort > -1 Minix filesystem, V2, 30 char names, %d zones
|
>0x402 beshort > -1 Minix filesystem, V2, 30 char names
|
||||||
|
>0x1e string minix \b, bootable
|
||||||
|
0x410 leshort 0x2478
|
||||||
|
>0x402 beshort < 100
|
||||||
|
>0x402 beshort > -1 Minix filesystem, V2, 30 char names
|
||||||
>0x1e string minix \b, bootable
|
>0x1e string minix \b, bootable
|
||||||
0x410 beshort 0x2478
|
0x410 beshort 0x2478
|
||||||
>0x402 beshort !0 Minix filesystem, V2, 30 char names (big endian), %d zones
|
>0x402 beshort !0 Minix filesystem, V2, 30 char names (big endian)
|
||||||
>0x1e string minix \b, bootable
|
|
||||||
0x410 leshort 0x4d5a
|
|
||||||
>0x402 beshort !0 Minix filesystem, V3, %d zones
|
|
||||||
>0x1e string minix \b, bootable
|
>0x1e string minix \b, bootable
|
||||||
|
0x418 leshort 0x4d5a
|
||||||
|
>0x402 beshort <100
|
||||||
|
>>0x402 beshort > -1 Minix filesystem, V3, 60 char names
|
||||||
|
|
||||||
# SGI disk labels - Nathan Scott <nathans@debian.org>
|
# SGI disk labels - Nathan Scott <nathans@debian.org>
|
||||||
0 belong 0x0BE5A941 SGI disk label (volume header)
|
0 belong 0x0BE5A941 SGI disk label (volume header)
|
||||||
@@ -2209,13 +2208,21 @@
|
|||||||
>>0x10024 belong x (blocksize %d,
|
>>0x10024 belong x (blocksize %d,
|
||||||
>>0x10060 string >\0 lockproto %s)
|
>>0x10060 string >\0 lockproto %s)
|
||||||
|
|
||||||
# BTRFS
|
# Russell Coker <russell@coker.com.au>
|
||||||
0x10040 string _BHRfS_M BTRFS Filesystem
|
0x10040 string _BHRfS_M BTRFS Filesystem
|
||||||
>0x1012b string >\0 (label "%s",
|
>0x1012b string >\0 label "%s",
|
||||||
>0x10090 lelong x sectorsize %d,
|
>0x10090 lelong x sectorsize %d,
|
||||||
>0x10094 lelong x nodesize %d,
|
>0x10094 lelong x nodesize %d,
|
||||||
>0x10098 lelong x leafsize %d)
|
>0x10098 lelong x leafsize %d,
|
||||||
|
>0x10020 belong x UUID=%8x-
|
||||||
|
>0x10024 beshort x \b%4x-
|
||||||
|
>0x10026 beshort x \b%4x-
|
||||||
|
>0x10028 beshort x \b%4x-
|
||||||
|
>0x1002a beshort x \b%4x
|
||||||
|
>0x1002c belong x \b%8x,
|
||||||
|
>0x10078 lequad x %lld/
|
||||||
|
>0x10070 lequad x \b%lld bytes used,
|
||||||
|
>0x10088 lequad x %lld devices
|
||||||
|
|
||||||
# dvdisaster's .ecc
|
# dvdisaster's .ecc
|
||||||
# From: "Nelson A. de Oliveira" <naoliv@gmail.com>
|
# From: "Nelson A. de Oliveira" <naoliv@gmail.com>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# $File: frame,v 1.12 2009/09/19 16:28:09 christos Exp $
|
# $File: frame,v 1.13 2015/08/29 07:10:35 christos Exp $
|
||||||
# frame: file(1) magic for FrameMaker files
|
# frame: file(1) magic for FrameMaker files
|
||||||
#
|
#
|
||||||
# This stuff came on a FrameMaker demo tape, most of which is
|
# This stuff came on a FrameMaker demo tape, most of which is
|
||||||
@@ -41,10 +41,10 @@
|
|||||||
>10 string 1.0 (1.0
|
>10 string 1.0 (1.0
|
||||||
>13 byte x %c)
|
>13 byte x %c)
|
||||||
# XXX - this book entry should be verified, if you find one, uncomment this
|
# XXX - this book entry should be verified, if you find one, uncomment this
|
||||||
#0 string \<Book\ FrameMaker Book (ASCII) file
|
#0 string \<Book\040 FrameMaker Book (ASCII) file
|
||||||
#!:mime application/x-mif
|
#!:mime application/x-mif
|
||||||
#>6 string 3.0 (3.0)
|
#>6 string 3.0 (3.0)
|
||||||
#>6 string 2.0 (2.0)
|
#>6 string 2.0 (2.0)
|
||||||
#>6 string 1.0 (1.0)
|
#>6 string 1.0 (1.0)
|
||||||
0 string \<Maker Intermediate Print File FrameMaker IPL file
|
0 string \<Maker\040Intermediate\040Print\040File FrameMaker IPL file
|
||||||
!:mime application/x-mif
|
!:mime application/x-mif
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# $File: iff,v 1.13 2011/09/06 11:00:06 christos Exp $
|
# $File: iff,v 1.14 2015/09/07 10:03:21 christos Exp $
|
||||||
# iff: file(1) magic for Interchange File Format (see also "audio" & "images")
|
# iff: file(1) magic for Interchange File Format (see also "audio" & "images")
|
||||||
#
|
#
|
||||||
# Daniel Quinlan (quinlan@yggdrasil.com) -- IFF was designed by Electronic
|
# Daniel Quinlan (quinlan@yggdrasil.com) -- IFF was designed by Electronic
|
||||||
@@ -62,6 +62,7 @@
|
|||||||
|
|
||||||
# These go at the end of the iff rules
|
# These go at the end of the iff rules
|
||||||
#
|
#
|
||||||
|
# David Griffith <dave@661.org>
|
||||||
# I don't see why these might collide with anything else.
|
# I don't see why these might collide with anything else.
|
||||||
#
|
#
|
||||||
# Interactive Fiction related formats
|
# Interactive Fiction related formats
|
||||||
@@ -69,3 +70,4 @@
|
|||||||
>8 string IFRS \b, Blorb Interactive Fiction
|
>8 string IFRS \b, Blorb Interactive Fiction
|
||||||
>>24 string Exec with executable chunk
|
>>24 string Exec with executable chunk
|
||||||
>8 string IFZS \b, Z-machine or Glulx saved game file (Quetzal)
|
>8 string IFZS \b, Z-machine or Glulx saved game file (Quetzal)
|
||||||
|
!:mime application/x-blorb
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# $File: images,v 1.106 2015/02/22 01:26:05 christos Exp $
|
# $File: images,v 1.107 2015/07/11 14:40:10 christos Exp $
|
||||||
# images: file(1) magic for image formats (see also "iff", and "c-lang" for
|
# images: file(1) magic for image formats (see also "iff", and "c-lang" for
|
||||||
# XPM bitmaps)
|
# XPM bitmaps)
|
||||||
#
|
#
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
# The next byte following the magic is always whitespace.
|
# The next byte following the magic is always whitespace.
|
||||||
# strength is changed to try these patterns before "x86 boot sector"
|
# strength is changed to try these patterns before "x86 boot sector"
|
||||||
0 name netpbm
|
0 name netpbm
|
||||||
>3 regex/s =[0-9]{1,50}\ [0-9]{1,50} Netpbm PPM image data
|
>3 regex/s =[0-9]{1,50}\ [0-9]{1,50} Netpbm image data
|
||||||
>>&0 regex =[0-9]{1,50} \b, size = %s x
|
>>&0 regex =[0-9]{1,50} \b, size = %s x
|
||||||
>>>&0 regex =[0-9]{1,50} \b %s
|
>>>&0 regex =[0-9]{1,50} \b %s
|
||||||
|
|
||||||
@@ -59,7 +59,6 @@
|
|||||||
!:strength + 45
|
!:strength + 45
|
||||||
!:mime image/x-portable-pixmap
|
!:mime image/x-portable-pixmap
|
||||||
|
|
||||||
|
|
||||||
0 string P4
|
0 string P4
|
||||||
>0 use netpbm
|
>0 use netpbm
|
||||||
>>0 string x \b, rawbits, bitmap
|
>>0 string x \b, rawbits, bitmap
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# $File: karma,v 1.7 2014/04/30 21:41:02 christos Exp $
|
# $File: karma,v 1.8 2015/08/29 07:10:35 christos Exp $
|
||||||
# karma: file(1) magic for Karma data files
|
# karma: file(1) magic for Karma data files
|
||||||
#
|
#
|
||||||
# From <rgooch@atnf.csiro.au>
|
# From <rgooch@atnf.csiro.au>
|
||||||
|
|
||||||
0 string KarmaRHD Version Karma Data Structure Version
|
0 string KarmaRHD\040Version Karma Data Structure Version
|
||||||
>16 belong x %u
|
>16 belong x %u
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# $File: linux,v 1.62 2015/05/03 13:06:36 christos Exp $
|
# $File: linux,v 1.63 2015/08/24 05:16:11 christos Exp $
|
||||||
# linux: file(1) magic for Linux files
|
# linux: file(1) magic for Linux files
|
||||||
#
|
#
|
||||||
# Values for Linux/i386 binaries, from Daniel Quinlan <quinlan@yggdrasil.com>
|
# Values for Linux/i386 binaries, from Daniel Quinlan <quinlan@yggdrasil.com>
|
||||||
@@ -417,6 +417,25 @@
|
|||||||
0 lelong 0xde020109 locale archive
|
0 lelong 0xde020109 locale archive
|
||||||
>24 lelong x %d strings
|
>24 lelong x %d strings
|
||||||
|
|
||||||
|
# Linux Software RAID (mdadm)
|
||||||
|
# Russell Coker <russell@coker.com.au>
|
||||||
|
0 name linuxraid
|
||||||
|
>16 belong x UUID=%8x:
|
||||||
|
>20 belong x \b%8x:
|
||||||
|
>24 belong x \b%8x:
|
||||||
|
>28 belong x \b%8x
|
||||||
|
>32 string x name=%s
|
||||||
|
>72 lelong x level=%d
|
||||||
|
>92 lelong x disks=%d
|
||||||
|
|
||||||
|
4096 lelong 0xa92b4efc Linux Software RAID
|
||||||
|
>4100 lelong x version 1.2 (%d)
|
||||||
|
>4096 use linuxraid
|
||||||
|
|
||||||
|
0 lelong 0xa92b4efc Linux Software RAID
|
||||||
|
>4 lelong x version 1.1 (%d)
|
||||||
|
>0 use linuxraid
|
||||||
|
|
||||||
# Summary: Database file for mlocate
|
# Summary: Database file for mlocate
|
||||||
# Description: A database file as used by mlocate, a fast implementation
|
# Description: A database file as used by mlocate, a fast implementation
|
||||||
# of locate/updatedb. It uses merging to reuse the existing
|
# of locate/updatedb. It uses merging to reuse the existing
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# $File: make,v 1.1 2011/12/08 12:12:46 rrt Exp $
|
# $File: make,v 1.2 2015/08/25 07:34:06 christos Exp $
|
||||||
# make: file(1) magic for makefiles
|
# make: file(1) magic for makefiles
|
||||||
#
|
#
|
||||||
0 regex/100l \^CFLAGS makefile script text
|
0 regex/100l \^CFLAGS makefile script text
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# $File: map,v 1.3 2015/07/09 15:16:41 christos Exp $
|
# $File: map,v 1.4 2015/08/10 05:18:27 christos Exp $
|
||||||
# map: file(1) magic for Map data
|
# map: file(1) magic for Map data
|
||||||
#
|
#
|
||||||
|
|
||||||
@@ -25,3 +25,17 @@
|
|||||||
>>53 byte 4 \b (Activity)
|
>>53 byte 4 \b (Activity)
|
||||||
>>53 byte 8 \b (Elevations)
|
>>53 byte 8 \b (Elevations)
|
||||||
>>53 byte 10 \b (Totals)
|
>>53 byte 10 \b (Totals)
|
||||||
|
|
||||||
|
# TOM TOM GPS watches ttbin files:
|
||||||
|
# http://github.com/ryanbinns/ttwatch/tree/master/ttbin
|
||||||
|
# From: Daniel Lenski
|
||||||
|
0 byte 0x20
|
||||||
|
>1 leshort 0x0007
|
||||||
|
>>0x76 byte 0x20
|
||||||
|
>>>0x77 leshort 0x0075 TomTom activity file, v7
|
||||||
|
>>>>8 leldate x (%s,
|
||||||
|
>>>>3 byte x device firmware %d.
|
||||||
|
>>>>4 byte x \b%d.
|
||||||
|
>>>>5 byte x \b%d,
|
||||||
|
>>>>6 leshort x product ID %04d)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# $File: msdos,v 1.100 2014/06/03 19:17:27 christos Exp $
|
# $File: msdos,v 1.101 2015/08/24 05:08:48 christos Exp $
|
||||||
# msdos: file(1) magic for MS-DOS files
|
# msdos: file(1) magic for MS-DOS files
|
||||||
#
|
#
|
||||||
|
|
||||||
@@ -772,7 +772,7 @@
|
|||||||
0 ulequad 0x3a000000024e4c MS Advisor help file
|
0 ulequad 0x3a000000024e4c MS Advisor help file
|
||||||
|
|
||||||
# HtmlHelp files (.chm)
|
# HtmlHelp files (.chm)
|
||||||
0 string/b ITSF\003\000\000\000\x60\000\000\000\001\000\000\000 MS Windows HtmlHelp Data
|
0 string/b ITSF\003\000\000\000\x60\000\000\000 MS Windows HtmlHelp Data
|
||||||
|
|
||||||
# GFA-BASIC (Wolfram Kleff)
|
# GFA-BASIC (Wolfram Kleff)
|
||||||
2 string/b GFA-BASIC3 GFA-BASIC 3 data
|
2 string/b GFA-BASIC3 GFA-BASIC 3 data
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# $File: netscape,v 1.6 2009/09/19 16:28:11 christos Exp $
|
# $File: netscape,v 1.7 2015/08/24 05:20:52 christos Exp $
|
||||||
# netscape: file(1) magic for Netscape files
|
# netscape: file(1) magic for Netscape files
|
||||||
# "H. Nanosecond" <aldomel@ix.netcom.com>
|
# "H. Nanosecond" <aldomel@ix.netcom.com>
|
||||||
# version 3 and 4 I think
|
# version 3 and 4 I think
|
||||||
@@ -22,4 +22,5 @@
|
|||||||
|
|
||||||
#
|
#
|
||||||
#This is files ending in .art, FIXME add more rules
|
#This is files ending in .art, FIXME add more rules
|
||||||
0 string JG\004\016\0\0\0\0 ART
|
0 string JG\004\016\0\0\0\0 AOL ART image
|
||||||
|
0 string JG\003\016\0\0\0\0 AOL ART image
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# $File: python,v 1.26 2014/08/04 05:58:40 christos Exp $
|
# $File: python,v 1.27 2015/09/08 13:59:44 christos Exp $
|
||||||
# python: file(1) magic for python
|
# python: file(1) magic for python
|
||||||
#
|
#
|
||||||
# Outlook puts """ too for urgent messages
|
# Outlook puts """ too for urgent messages
|
||||||
@@ -26,12 +26,16 @@
|
|||||||
0 belong 0xee0c0d0a python 3.4 byte-compiled
|
0 belong 0xee0c0d0a python 3.4 byte-compiled
|
||||||
|
|
||||||
0 search/1/w #!\ /usr/bin/python Python script text executable
|
0 search/1/w #!\ /usr/bin/python Python script text executable
|
||||||
|
!:strength + 10
|
||||||
!:mime text/x-python
|
!:mime text/x-python
|
||||||
0 search/1/w #!\ /usr/local/bin/python Python script text executable
|
0 search/1/w #!\ /usr/local/bin/python Python script text executable
|
||||||
|
!:strength + 10
|
||||||
!:mime text/x-python
|
!:mime text/x-python
|
||||||
0 search/1 #!/usr/bin/env\ python Python script text executable
|
0 search/1 #!/usr/bin/env\ python Python script text executable
|
||||||
|
!:strength + 10
|
||||||
!:mime text/x-python
|
!:mime text/x-python
|
||||||
0 search/1 #!\ /usr/bin/env\ python Python script text executable
|
0 search/10 #!\ /usr/bin/env\ python Python script text executable
|
||||||
|
!:strength + 10
|
||||||
!:mime text/x-python
|
!:mime text/x-python
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# $File: scientific,v 1.9 2014/06/03 19:01:34 christos Exp $
|
# $File: scientific,v 1.10 2015/08/24 05:18:55 christos Exp $
|
||||||
# scientific: file(1) magic for scientific formats
|
# scientific: file(1) magic for scientific formats
|
||||||
#
|
#
|
||||||
# From: Joe Krahn <krahn@niehs.nih.gov>
|
# From: Joe Krahn <krahn@niehs.nih.gov>
|
||||||
@@ -104,3 +104,8 @@
|
|||||||
>>5 byte x version %d.0
|
>>5 byte x version %d.0
|
||||||
>4 byte >0x00 version %d
|
>4 byte >0x00 version %d
|
||||||
>>5 byte x \b.%d
|
>>5 byte x \b.%d
|
||||||
|
|
||||||
|
# Type: LXT (interLaced eXtensible Trace)
|
||||||
|
# chrysn <chrysn@fsfe.org>
|
||||||
|
0 beshort 0x0138 interLaced eXtensible Trace (LXT) file
|
||||||
|
>2 beshort >0 (Version %u)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# $File: sgi,v 1.21 2014/04/30 21:41:02 christos Exp $
|
# $File: sgi,v 1.22 2015/08/29 07:10:35 christos Exp $
|
||||||
# sgi: file(1) magic for Silicon Graphics operating systems and applications
|
# sgi: file(1) magic for Silicon Graphics operating systems and applications
|
||||||
#
|
#
|
||||||
# Executable images are handled either in aout (for old-style a.out
|
# Executable images are handled either in aout (for old-style a.out
|
||||||
@@ -55,8 +55,8 @@
|
|||||||
0 string WNGZWZSS Wingz spreadsheet
|
0 string WNGZWZSS Wingz spreadsheet
|
||||||
0 string WNGZWZHP Wingz help file
|
0 string WNGZWZHP Wingz help file
|
||||||
#
|
#
|
||||||
0 string #Inventor V IRIS Inventor 1.0 file
|
0 string #Inventor\040V IRIS Inventor 1.0 file
|
||||||
0 string #Inventor V2 Open Inventor 2.0 file
|
0 string #Inventor\040V2 Open Inventor 2.0 file
|
||||||
# GLF is OpenGL stream encoding
|
# GLF is OpenGL stream encoding
|
||||||
0 string glfHeadMagic(); GLF_TEXT
|
0 string glfHeadMagic(); GLF_TEXT
|
||||||
4 belong 0x7d000000 GLF_BINARY_LSB_FIRST
|
4 belong 0x7d000000 GLF_BINARY_LSB_FIRST
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------ # $File: sgml,v 1.32 2015/07/11 15:08:53 christos Exp $
|
||||||
# $File: sgml,v 1.31 2015/03/11 19:38:04 christos Exp $
|
|
||||||
# Type: SVG Vectorial Graphics
|
# Type: SVG Vectorial Graphics
|
||||||
# From: Noel Torres <tecnico@ejerciciosresueltos.com>
|
# From: Noel Torres <tecnico@ejerciciosresueltos.com>
|
||||||
0 string \<?xml\ version="
|
0 string \<?xml\ version="
|
||||||
@@ -24,16 +23,16 @@
|
|||||||
|
|
||||||
# xhtml
|
# xhtml
|
||||||
0 string/t \<?xml\ version="
|
0 string/t \<?xml\ version="
|
||||||
>15 string >\0
|
>19 search/4096/cWbt \<!doctype\ html XHTML document text
|
||||||
>>19 search/4096/cWbt \<!doctype\ html XHTML document text
|
>>15 string >\0 (version %.3s)
|
||||||
!:mime text/html
|
!:mime text/html
|
||||||
0 string/t \<?xml\ version='
|
0 string/t \<?xml\ version='
|
||||||
>15 string >\0
|
>19 search/4096/cWbt \<!doctype\ html XHTML document text
|
||||||
>>19 search/4096/cWbt \<!doctype\ html XHTML document text
|
>>15 string >\0 (version %.3s)
|
||||||
!:mime text/html
|
!:mime text/html
|
||||||
0 string/t \<?xml\ version="
|
0 string/t \<?xml\ version="
|
||||||
>15 string >\0
|
>19 search/4096/cWbt \<html broken XHTML document text
|
||||||
>>19 search/4096/cWbt \<html broken XHTML document text
|
>>15 string >\0 (version %.3s)
|
||||||
!:mime text/html
|
!:mime text/html
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
@@ -106,9 +105,6 @@
|
|||||||
>15 string/t >\0 %.3s document text
|
>15 string/t >\0 %.3s document text
|
||||||
>>23 search/1 \<xsl:stylesheet (XSL stylesheet)
|
>>23 search/1 \<xsl:stylesheet (XSL stylesheet)
|
||||||
>>24 search/1 \<xsl:stylesheet (XSL stylesheet)
|
>>24 search/1 \<xsl:stylesheet (XSL stylesheet)
|
||||||
0 search/1/wbt \<?xml XML document text
|
|
||||||
!:mime application/xml
|
|
||||||
!:strength - 10
|
|
||||||
0 search/1/wt \<?XML broken XML document text
|
0 search/1/wt \<?XML broken XML document text
|
||||||
!:mime application/xml
|
!:mime application/xml
|
||||||
!:strength - 10
|
!:strength - 10
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# $File: windows,v 1.10 2014/09/24 19:52:46 christos Exp $
|
# $File: windows,v 1.12 2015/08/29 07:10:35 christos Exp $
|
||||||
# windows: file(1) magic for Microsoft Windows
|
# windows: file(1) magic for Microsoft Windows
|
||||||
#
|
#
|
||||||
# This file is mainly reserved for files where programs
|
# This file is mainly reserved for files where programs
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
>20 lelong&16 16 \b, Has Working directory
|
>20 lelong&16 16 \b, Has Working directory
|
||||||
>20 lelong&32 32 \b, Has command line arguments
|
>20 lelong&32 32 \b, Has command line arguments
|
||||||
>20 lelong&64 64 \b, Icon
|
>20 lelong&64 64 \b, Icon
|
||||||
>>56 lelong \b number=%d
|
>>56 lelong x \b number=%d
|
||||||
>24 lelong&1 1 \b, Read-Only
|
>24 lelong&1 1 \b, Read-Only
|
||||||
>24 lelong&2 2 \b, Hidden
|
>24 lelong&2 2 \b, Hidden
|
||||||
>24 lelong&4 4 \b, System
|
>24 lelong&4 4 \b, System
|
||||||
@@ -239,6 +239,7 @@
|
|||||||
# http://read.pudn.com/downloads3/sourcecode/windows/248345/win2k/private/windows/setup/setupapi/inf.h__.htm
|
# http://read.pudn.com/downloads3/sourcecode/windows/248345/win2k/private/windows/setup/setupapi/inf.h__.htm
|
||||||
# GRR: line below too general as it catches also PDP-11 UNIX/RT ldp
|
# GRR: line below too general as it catches also PDP-11 UNIX/RT ldp
|
||||||
0 leshort&0xFeFe 0x0000
|
0 leshort&0xFeFe 0x0000
|
||||||
|
!:strength -5
|
||||||
# test for unused null bits in PNF_FLAGs
|
# test for unused null bits in PNF_FLAGs
|
||||||
>4 ulelong&0xFCffFe00 0x00000000
|
>4 ulelong&0xFCffFe00 0x00000000
|
||||||
# only found 58h for Offset of WinDirPath immediately after _PNF_HEADER structure
|
# only found 58h for Offset of WinDirPath immediately after _PNF_HEADER structure
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
#include "file.h"
|
#include "file.h"
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
FILE_RCSID("@(#)$File: apprentice.c,v 1.233 2015/06/10 00:57:41 christos Exp $")
|
FILE_RCSID("@(#)$File: apprentice.c,v 1.238 2015/09/12 18:10:42 christos Exp $")
|
||||||
#endif /* lint */
|
#endif /* lint */
|
||||||
|
|
||||||
#include "magic.h"
|
#include "magic.h"
|
||||||
@@ -531,6 +531,7 @@ file_ms_alloc(int flags)
|
|||||||
ms->elf_shnum_max = FILE_ELF_SHNUM_MAX;
|
ms->elf_shnum_max = FILE_ELF_SHNUM_MAX;
|
||||||
ms->elf_phnum_max = FILE_ELF_PHNUM_MAX;
|
ms->elf_phnum_max = FILE_ELF_PHNUM_MAX;
|
||||||
ms->elf_notes_max = FILE_ELF_NOTES_MAX;
|
ms->elf_notes_max = FILE_ELF_NOTES_MAX;
|
||||||
|
ms->regex_max = FILE_REGEX_MAX;
|
||||||
return ms;
|
return ms;
|
||||||
free:
|
free:
|
||||||
free(ms);
|
free(ms);
|
||||||
@@ -540,6 +541,7 @@ file_ms_alloc(int flags)
|
|||||||
private void
|
private void
|
||||||
apprentice_unmap(struct magic_map *map)
|
apprentice_unmap(struct magic_map *map)
|
||||||
{
|
{
|
||||||
|
size_t i;
|
||||||
if (map == NULL)
|
if (map == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -552,6 +554,8 @@ apprentice_unmap(struct magic_map *map)
|
|||||||
#endif
|
#endif
|
||||||
case MAP_TYPE_MALLOC:
|
case MAP_TYPE_MALLOC:
|
||||||
free(map->p);
|
free(map->p);
|
||||||
|
for (i = 0; i < MAGIC_SETS; i++)
|
||||||
|
free(map->magic[i]);
|
||||||
break;
|
break;
|
||||||
case MAP_TYPE_USER:
|
case MAP_TYPE_USER:
|
||||||
break;
|
break;
|
||||||
@@ -1288,6 +1292,7 @@ apprentice_load(struct magic_set *ms, const char *fn, int action)
|
|||||||
file_oomem(ms, sizeof(*map));
|
file_oomem(ms, sizeof(*map));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
map->type = MAP_TYPE_MALLOC;
|
||||||
|
|
||||||
/* print silly verbose header for USG compat. */
|
/* print silly verbose header for USG compat. */
|
||||||
if (action == FILE_CHECK)
|
if (action == FILE_CHECK)
|
||||||
@@ -1348,6 +1353,7 @@ apprentice_load(struct magic_set *ms, const char *fn, int action)
|
|||||||
}
|
}
|
||||||
i = set_text_binary(ms, mset[j].me, mset[j].count, i);
|
i = set_text_binary(ms, mset[j].me, mset[j].count, i);
|
||||||
}
|
}
|
||||||
|
if (mset[j].me)
|
||||||
qsort(mset[j].me, mset[j].count, sizeof(*mset[j].me),
|
qsort(mset[j].me, mset[j].count, sizeof(*mset[j].me),
|
||||||
apprentice_sort);
|
apprentice_sort);
|
||||||
|
|
||||||
@@ -2555,11 +2561,13 @@ getvalue(struct magic_set *ms, struct magic *m, const char **p, int action)
|
|||||||
case FILE_LEFLOAT:
|
case FILE_LEFLOAT:
|
||||||
if (m->reln != 'x') {
|
if (m->reln != 'x') {
|
||||||
char *ep;
|
char *ep;
|
||||||
|
errno = 0;
|
||||||
#ifdef HAVE_STRTOF
|
#ifdef HAVE_STRTOF
|
||||||
m->value.f = strtof(*p, &ep);
|
m->value.f = strtof(*p, &ep);
|
||||||
#else
|
#else
|
||||||
m->value.f = (float)strtod(*p, &ep);
|
m->value.f = (float)strtod(*p, &ep);
|
||||||
#endif
|
#endif
|
||||||
|
if (errno == 0)
|
||||||
*p = ep;
|
*p = ep;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2568,18 +2576,23 @@ getvalue(struct magic_set *ms, struct magic *m, const char **p, int action)
|
|||||||
case FILE_LEDOUBLE:
|
case FILE_LEDOUBLE:
|
||||||
if (m->reln != 'x') {
|
if (m->reln != 'x') {
|
||||||
char *ep;
|
char *ep;
|
||||||
|
errno = 0;
|
||||||
m->value.d = strtod(*p, &ep);
|
m->value.d = strtod(*p, &ep);
|
||||||
|
if (errno == 0)
|
||||||
*p = ep;
|
*p = ep;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
default:
|
default:
|
||||||
if (m->reln != 'x') {
|
if (m->reln != 'x') {
|
||||||
char *ep;
|
char *ep;
|
||||||
|
errno = 0;
|
||||||
m->value.q = file_signextend(ms, m,
|
m->value.q = file_signextend(ms, m,
|
||||||
(uint64_t)strtoull(*p, &ep, 0));
|
(uint64_t)strtoull(*p, &ep, 0));
|
||||||
|
if (errno == 0) {
|
||||||
*p = ep;
|
*p = ep;
|
||||||
eatsize(p);
|
eatsize(p);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2614,6 +2627,7 @@ getstr(struct magic_set *ms, struct magic *m, const char *s, int warn)
|
|||||||
case '\0':
|
case '\0':
|
||||||
if (warn)
|
if (warn)
|
||||||
file_magwarn(ms, "incomplete escape");
|
file_magwarn(ms, "incomplete escape");
|
||||||
|
s--;
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
case '\t':
|
case '\t':
|
||||||
@@ -2737,6 +2751,7 @@ getstr(struct magic_set *ms, struct magic *m, const char *s, int warn)
|
|||||||
} else
|
} else
|
||||||
*p++ = (char)c;
|
*p++ = (char)c;
|
||||||
}
|
}
|
||||||
|
--s;
|
||||||
out:
|
out:
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
m->vallen = CAST(unsigned char, (p - origp));
|
m->vallen = CAST(unsigned char, (p - origp));
|
||||||
@@ -3209,9 +3224,10 @@ file_pstring_length_size(const struct magic *m)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected size_t
|
protected size_t
|
||||||
file_pstring_get_length(const struct magic *m, const char *s)
|
file_pstring_get_length(const struct magic *m, const char *ss)
|
||||||
{
|
{
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
|
const unsigned char *s = (const unsigned char *)ss;
|
||||||
|
|
||||||
switch (m->str_flags & PSTRING_LEN) {
|
switch (m->str_flags & PSTRING_LEN) {
|
||||||
case PSTRING_1_LE:
|
case PSTRING_1_LE:
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
#include "file.h"
|
#include "file.h"
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
FILE_RCSID("@(#)$File: file.c,v 1.165 2015/06/11 12:52:32 christos Exp $")
|
FILE_RCSID("@(#)$File: file.c,v 1.167 2015/09/11 17:24:09 christos Exp $")
|
||||||
#endif /* lint */
|
#endif /* lint */
|
||||||
|
|
||||||
#include "magic.h"
|
#include "magic.h"
|
||||||
@@ -131,6 +131,7 @@ private struct {
|
|||||||
{ "elf_phnum", MAGIC_PARAM_ELF_PHNUM_MAX, 0 },
|
{ "elf_phnum", MAGIC_PARAM_ELF_PHNUM_MAX, 0 },
|
||||||
{ "elf_shnum", MAGIC_PARAM_ELF_SHNUM_MAX, 0 },
|
{ "elf_shnum", MAGIC_PARAM_ELF_SHNUM_MAX, 0 },
|
||||||
{ "elf_notes", MAGIC_PARAM_ELF_NOTES_MAX, 0 },
|
{ "elf_notes", MAGIC_PARAM_ELF_NOTES_MAX, 0 },
|
||||||
|
{ "regex", MAGIC_PARAM_REGEX_MAX, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
private char *progname; /* used throughout */
|
private char *progname; /* used throughout */
|
||||||
@@ -237,6 +238,7 @@ main(int argc, char *argv[])
|
|||||||
if (magic == NULL)
|
if (magic == NULL)
|
||||||
if ((magic = load(magicfile, flags)) == NULL)
|
if ((magic = load(magicfile, flags)) == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
|
applyparam(magic);
|
||||||
e |= unwrap(magic, optarg);
|
e |= unwrap(magic, optarg);
|
||||||
++didsomefiles;
|
++didsomefiles;
|
||||||
break;
|
break;
|
||||||
|
|||||||
+11
-7
@@ -27,7 +27,7 @@
|
|||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* file.h - definitions for file(1) program
|
* file.h - definitions for file(1) program
|
||||||
* @(#)$File: file.h,v 1.168 2015/04/09 20:01:41 christos Exp $
|
* @(#)$File: file.h,v 1.172 2015/09/11 17:24:09 christos Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __file_h__
|
#ifndef __file_h__
|
||||||
@@ -44,9 +44,11 @@
|
|||||||
#define SIZE_T_FORMAT ""
|
#define SIZE_T_FORMAT ""
|
||||||
#endif
|
#endif
|
||||||
#define INT64_T_FORMAT "I64"
|
#define INT64_T_FORMAT "I64"
|
||||||
|
#define INTMAX_T_FORMAT "I64"
|
||||||
#else
|
#else
|
||||||
#define SIZE_T_FORMAT "z"
|
#define SIZE_T_FORMAT "z"
|
||||||
#define INT64_T_FORMAT "ll"
|
#define INT64_T_FORMAT "ll"
|
||||||
|
#define INTMAX_T_FORMAT "j"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h> /* Include that here, to make sure __P gets defined */
|
#include <stdio.h> /* Include that here, to make sure __P gets defined */
|
||||||
@@ -300,15 +302,15 @@ struct magic {
|
|||||||
#define num_mask _u._mask
|
#define num_mask _u._mask
|
||||||
#define str_range _u._s._count
|
#define str_range _u._s._count
|
||||||
#define str_flags _u._s._flags
|
#define str_flags _u._s._flags
|
||||||
/* Words 9-16 */
|
/* Words 9-24 */
|
||||||
union VALUETYPE value; /* either number or string */
|
union VALUETYPE value; /* either number or string */
|
||||||
/* Words 17-32 */
|
/* Words 25-40 */
|
||||||
char desc[MAXDESC]; /* description */
|
char desc[MAXDESC]; /* description */
|
||||||
/* Words 33-52 */
|
/* Words 41-60 */
|
||||||
char mimetype[MAXMIME]; /* MIME type */
|
char mimetype[MAXMIME]; /* MIME type */
|
||||||
/* Words 53-54 */
|
/* Words 61-62 */
|
||||||
char apple[8]; /* APPLE CREATOR/TYPE */
|
char apple[8]; /* APPLE CREATOR/TYPE */
|
||||||
/* Words 55-63 */
|
/* Words 63-78 */
|
||||||
char ext[64]; /* Popular extensions */
|
char ext[64]; /* Popular extensions */
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -413,11 +415,13 @@ struct magic_set {
|
|||||||
uint16_t elf_shnum_max;
|
uint16_t elf_shnum_max;
|
||||||
uint16_t elf_phnum_max;
|
uint16_t elf_phnum_max;
|
||||||
uint16_t elf_notes_max;
|
uint16_t elf_notes_max;
|
||||||
|
uint16_t regex_max;
|
||||||
#define FILE_INDIR_MAX 15
|
#define FILE_INDIR_MAX 15
|
||||||
#define FILE_NAME_MAX 30
|
#define FILE_NAME_MAX 30
|
||||||
#define FILE_ELF_SHNUM_MAX 32768
|
#define FILE_ELF_SHNUM_MAX 32768
|
||||||
#define FILE_ELF_PHNUM_MAX 128
|
#define FILE_ELF_PHNUM_MAX 2048
|
||||||
#define FILE_ELF_NOTES_MAX 256
|
#define FILE_ELF_NOTES_MAX 256
|
||||||
|
#define FILE_REGEX_MAX 8192
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Type for Unicode characters */
|
/* Type for Unicode characters */
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ OPT('0', "print0", 0, " terminate filenames with ASCII NUL\n")
|
|||||||
#if defined(HAVE_UTIME) || defined(HAVE_UTIMES)
|
#if defined(HAVE_UTIME) || defined(HAVE_UTIMES)
|
||||||
OPT('p', "preserve-date", 0, " preserve access times on files\n")
|
OPT('p', "preserve-date", 0, " preserve access times on files\n")
|
||||||
#endif
|
#endif
|
||||||
OPT('P', "parameter", 0, " set file engine parameter limits\n"
|
OPT('P', "parameter", 1, " set file engine parameter limits\n"
|
||||||
" indir 15 recursion limit for indirection\n"
|
" indir 15 recursion limit for indirection\n"
|
||||||
" name 30 use limit for name/use magic\n"
|
" name 30 use limit for name/use magic\n"
|
||||||
" elf_notes 256 max ELF notes processed\n"
|
" elf_notes 256 max ELF notes processed\n"
|
||||||
|
|||||||
+29
-19
@@ -27,7 +27,7 @@
|
|||||||
#include "file.h"
|
#include "file.h"
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
FILE_RCSID("@(#)$File: funcs.c,v 1.83 2015/06/16 14:17:37 christos Exp $")
|
FILE_RCSID("@(#)$File: funcs.c,v 1.84 2015/09/10 13:32:19 christos Exp $")
|
||||||
#endif /* lint */
|
#endif /* lint */
|
||||||
|
|
||||||
#include "magic.h"
|
#include "magic.h"
|
||||||
@@ -204,7 +204,10 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__u
|
|||||||
|
|
||||||
#ifdef __EMX__
|
#ifdef __EMX__
|
||||||
if ((ms->flags & MAGIC_NO_CHECK_APPTYPE) == 0 && inname) {
|
if ((ms->flags & MAGIC_NO_CHECK_APPTYPE) == 0 && inname) {
|
||||||
switch (file_os2_apptype(ms, inname, buf, nb)) {
|
m = file_os2_apptype(ms, inname, buf, nb);
|
||||||
|
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||||
|
(void)fprintf(stderr, "[try os2_apptype %d]\n", m);
|
||||||
|
switch (m) {
|
||||||
case -1:
|
case -1:
|
||||||
return -1;
|
return -1;
|
||||||
case 0:
|
case 0:
|
||||||
@@ -216,37 +219,43 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__u
|
|||||||
#endif
|
#endif
|
||||||
#if HAVE_FORK
|
#if HAVE_FORK
|
||||||
/* try compression stuff */
|
/* try compression stuff */
|
||||||
if ((ms->flags & MAGIC_NO_CHECK_COMPRESS) == 0)
|
if ((ms->flags & MAGIC_NO_CHECK_COMPRESS) == 0) {
|
||||||
if ((m = file_zmagic(ms, fd, inname, ubuf, nb)) != 0) {
|
m = file_zmagic(ms, fd, inname, ubuf, nb);
|
||||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||||
(void)fprintf(stderr, "zmagic %d\n", m);
|
(void)fprintf(stderr, "[try zmagic %d]\n", m);
|
||||||
|
if (m) {
|
||||||
goto done_encoding;
|
goto done_encoding;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Check if we have a tar file */
|
/* Check if we have a tar file */
|
||||||
if ((ms->flags & MAGIC_NO_CHECK_TAR) == 0)
|
if ((ms->flags & MAGIC_NO_CHECK_TAR) == 0) {
|
||||||
if ((m = file_is_tar(ms, ubuf, nb)) != 0) {
|
m = file_is_tar(ms, ubuf, nb);
|
||||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||||
(void)fprintf(stderr, "tar %d\n", m);
|
(void)fprintf(stderr, "[try tar %d]\n", m);
|
||||||
|
if (m) {
|
||||||
if (checkdone(ms, &rv))
|
if (checkdone(ms, &rv))
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Check if we have a CDF file */
|
/* Check if we have a CDF file */
|
||||||
if ((ms->flags & MAGIC_NO_CHECK_CDF) == 0)
|
if ((ms->flags & MAGIC_NO_CHECK_CDF) == 0) {
|
||||||
if ((m = file_trycdf(ms, fd, ubuf, nb)) != 0) {
|
m = file_trycdf(ms, fd, ubuf, nb);
|
||||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||||
(void)fprintf(stderr, "cdf %d\n", m);
|
(void)fprintf(stderr, "[try cdf %d]\n", m);
|
||||||
|
if (m) {
|
||||||
if (checkdone(ms, &rv))
|
if (checkdone(ms, &rv))
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* try soft magic tests */
|
/* try soft magic tests */
|
||||||
if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0)
|
if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0)
|
||||||
if ((m = file_softmagic(ms, ubuf, nb, 0, NULL, BINTEST,
|
m = file_softmagic(ms, ubuf, nb, 0, NULL, BINTEST, looks_text);
|
||||||
looks_text)) != 0) {
|
|
||||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||||
(void)fprintf(stderr, "softmagic %d\n", m);
|
(void)fprintf(stderr, "[try softmagic %d]\n", m);
|
||||||
|
if (m) {
|
||||||
#ifdef BUILTIN_ELF
|
#ifdef BUILTIN_ELF
|
||||||
if ((ms->flags & MAGIC_NO_CHECK_ELF) == 0 && m == 1 &&
|
if ((ms->flags & MAGIC_NO_CHECK_ELF) == 0 && m == 1 &&
|
||||||
nb > 5 && fd != -1) {
|
nb > 5 && fd != -1) {
|
||||||
@@ -259,10 +268,10 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__u
|
|||||||
* ELF headers that cannot easily * be
|
* ELF headers that cannot easily * be
|
||||||
* extracted with rules in the magic file.
|
* extracted with rules in the magic file.
|
||||||
*/
|
*/
|
||||||
if ((m = file_tryelf(ms, fd, ubuf, nb)) != 0)
|
m = file_tryelf(ms, fd, ubuf, nb);
|
||||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||||
(void)fprintf(stderr,
|
(void)fprintf(stderr, "[try elf %d]\n",
|
||||||
"elf %d\n", m);
|
m);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (checkdone(ms, &rv))
|
if (checkdone(ms, &rv))
|
||||||
@@ -272,9 +281,10 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__u
|
|||||||
/* try text properties */
|
/* try text properties */
|
||||||
if ((ms->flags & MAGIC_NO_CHECK_TEXT) == 0) {
|
if ((ms->flags & MAGIC_NO_CHECK_TEXT) == 0) {
|
||||||
|
|
||||||
if ((m = file_ascmagic(ms, ubuf, nb, looks_text)) != 0) {
|
m = file_ascmagic(ms, ubuf, nb, looks_text);
|
||||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||||
(void)fprintf(stderr, "ascmagic %d\n", m);
|
(void)fprintf(stderr, "[try ascmagic %d]\n", m);
|
||||||
|
if (m) {
|
||||||
if (checkdone(ms, &rv))
|
if (checkdone(ms, &rv))
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
/* $File: gmtime_r.c,v 1.1 2015/01/09 19:28:32 christos Exp $ */
|
/* $File: gmtime_r.c,v 1.2 2015/07/11 14:41:37 christos Exp $ */
|
||||||
|
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
FILE_RCSID("@(#)$File: gmtime_r.c,v 1.1 2015/01/09 19:28:32 christos Exp $")
|
FILE_RCSID("@(#)$File: gmtime_r.c,v 1.2 2015/07/11 14:41:37 christos Exp $")
|
||||||
#endif /* lint */
|
#endif /* lint */
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/* asctime_r is not thread-safe anyway */
|
/* asctime_r is not thread-safe anyway */
|
||||||
struct tm *
|
struct tm *
|
||||||
gmtime_r(const time_t t, struct tm *tm)
|
gmtime_r(const time_t *t, struct tm *tm)
|
||||||
{
|
{
|
||||||
struct tm *tmp = gmtime(t);
|
struct tm *tmp = gmtime(t);
|
||||||
if (tmp == NULL)
|
if (tmp == NULL)
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
/* $File: localtime_r.c,v 1.1 2015/01/09 19:28:32 christos Exp $ */
|
/* $File: localtime_r.c,v 1.2 2015/07/11 14:41:37 christos Exp $ */
|
||||||
|
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
FILE_RCSID("@(#)$File: localtime_r.c,v 1.1 2015/01/09 19:28:32 christos Exp $")
|
FILE_RCSID("@(#)$File: localtime_r.c,v 1.2 2015/07/11 14:41:37 christos Exp $")
|
||||||
#endif /* lint */
|
#endif /* lint */
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/* asctime_r is not thread-safe anyway */
|
/* asctime_r is not thread-safe anyway */
|
||||||
struct tm *
|
struct tm *
|
||||||
localtime_r(const time_t t, struct tm *tm)
|
localtime_r(const time_t *t, struct tm *tm)
|
||||||
{
|
{
|
||||||
struct tm *tmp = localtime(t);
|
struct tm *tmp = localtime(t);
|
||||||
if (tmp == NULL)
|
if (tmp == NULL)
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
#include "file.h"
|
#include "file.h"
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
FILE_RCSID("@(#)$File: magic.c,v 1.93 2015/04/15 23:47:58 christos Exp $")
|
FILE_RCSID("@(#)$File: magic.c,v 1.95 2015/09/11 17:24:09 christos Exp $")
|
||||||
#endif /* lint */
|
#endif /* lint */
|
||||||
|
|
||||||
#include "magic.h"
|
#include "magic.h"
|
||||||
@@ -137,6 +137,14 @@ _w32_get_magic_relative_to(char **hmagicpath, HINSTANCE module)
|
|||||||
|
|
||||||
PathRemoveFileSpecA(dllpath);
|
PathRemoveFileSpecA(dllpath);
|
||||||
|
|
||||||
|
if (module) {
|
||||||
|
char exepath[MAX_PATH];
|
||||||
|
GetModuleFileNameA(NULL, exepath, MAX_PATH);
|
||||||
|
PathRemoveFileSpecA(exepath);
|
||||||
|
if (stricmp(exepath, dllpath) == 0)
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
sp = strlen(dllpath);
|
sp = strlen(dllpath);
|
||||||
if (sp > 3 && stricmp(&dllpath[sp - 3], "bin") == 0) {
|
if (sp > 3 && stricmp(&dllpath[sp - 3], "bin") == 0) {
|
||||||
_w32_append_path(hmagicpath,
|
_w32_append_path(hmagicpath,
|
||||||
@@ -595,6 +603,9 @@ magic_setparam(struct magic_set *ms, int param, const void *val)
|
|||||||
case MAGIC_PARAM_ELF_NOTES_MAX:
|
case MAGIC_PARAM_ELF_NOTES_MAX:
|
||||||
ms->elf_notes_max = (uint16_t)*(const size_t *)val;
|
ms->elf_notes_max = (uint16_t)*(const size_t *)val;
|
||||||
return 0;
|
return 0;
|
||||||
|
case MAGIC_PARAM_REGEX_MAX:
|
||||||
|
ms->elf_notes_max = (uint16_t)*(const size_t *)val;
|
||||||
|
return 0;
|
||||||
default:
|
default:
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
@@ -620,6 +631,9 @@ magic_getparam(struct magic_set *ms, int param, void *val)
|
|||||||
case MAGIC_PARAM_ELF_NOTES_MAX:
|
case MAGIC_PARAM_ELF_NOTES_MAX:
|
||||||
*(size_t *)val = ms->elf_notes_max;
|
*(size_t *)val = ms->elf_notes_max;
|
||||||
return 0;
|
return 0;
|
||||||
|
case MAGIC_PARAM_REGEX_MAX:
|
||||||
|
*(size_t *)val = ms->regex_max;
|
||||||
|
return 0;
|
||||||
default:
|
default:
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -80,7 +80,7 @@
|
|||||||
#define MAGIC_NO_CHECK_FORTRAN 0x000000 /* Don't check ascii/fortran */
|
#define MAGIC_NO_CHECK_FORTRAN 0x000000 /* Don't check ascii/fortran */
|
||||||
#define MAGIC_NO_CHECK_TROFF 0x000000 /* Don't check ascii/troff */
|
#define MAGIC_NO_CHECK_TROFF 0x000000 /* Don't check ascii/troff */
|
||||||
|
|
||||||
#define MAGIC_VERSION 522 /* This implementation */
|
#define MAGIC_VERSION 524 /* This implementation */
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -113,6 +113,7 @@ int magic_errno(magic_t);
|
|||||||
#define MAGIC_PARAM_ELF_PHNUM_MAX 2
|
#define MAGIC_PARAM_ELF_PHNUM_MAX 2
|
||||||
#define MAGIC_PARAM_ELF_SHNUM_MAX 3
|
#define MAGIC_PARAM_ELF_SHNUM_MAX 3
|
||||||
#define MAGIC_PARAM_ELF_NOTES_MAX 4
|
#define MAGIC_PARAM_ELF_NOTES_MAX 4
|
||||||
|
#define MAGIC_PARAM_REGEX_MAX 5
|
||||||
|
|
||||||
int magic_setparam(magic_t, int, const void *);
|
int magic_setparam(magic_t, int, const void *);
|
||||||
int magic_getparam(magic_t, int, void *);
|
int magic_getparam(magic_t, int, void *);
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ int magic_errno(magic_t);
|
|||||||
#define MAGIC_PARAM_ELF_PHNUM_MAX 2
|
#define MAGIC_PARAM_ELF_PHNUM_MAX 2
|
||||||
#define MAGIC_PARAM_ELF_SHNUM_MAX 3
|
#define MAGIC_PARAM_ELF_SHNUM_MAX 3
|
||||||
#define MAGIC_PARAM_ELF_NOTES_MAX 4
|
#define MAGIC_PARAM_ELF_NOTES_MAX 4
|
||||||
|
#define MAGIC_PARAM_REGEX_MAX 5
|
||||||
|
|
||||||
int magic_setparam(magic_t, int, const void *);
|
int magic_setparam(magic_t, int, const void *);
|
||||||
int magic_getparam(magic_t, int, void *);
|
int magic_getparam(magic_t, int, void *);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
#include "file.h"
|
#include "file.h"
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
FILE_RCSID("@(#)$File: print.c,v 1.79 2015/01/09 19:28:32 christos Exp $")
|
FILE_RCSID("@(#)$File: print.c,v 1.80 2015/07/16 14:28:57 christos Exp $")
|
||||||
#endif /* lint */
|
#endif /* lint */
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -156,26 +156,26 @@ file_mdump(struct magic *m)
|
|||||||
case FILE_BEDATE:
|
case FILE_BEDATE:
|
||||||
case FILE_MEDATE:
|
case FILE_MEDATE:
|
||||||
(void)fprintf(stderr, "%s,",
|
(void)fprintf(stderr, "%s,",
|
||||||
file_fmttime(m->value.l, FILE_T_LOCAL, tbuf));
|
file_fmttime(m->value.l, 0, tbuf));
|
||||||
break;
|
break;
|
||||||
case FILE_LDATE:
|
case FILE_LDATE:
|
||||||
case FILE_LELDATE:
|
case FILE_LELDATE:
|
||||||
case FILE_BELDATE:
|
case FILE_BELDATE:
|
||||||
case FILE_MELDATE:
|
case FILE_MELDATE:
|
||||||
(void)fprintf(stderr, "%s,",
|
(void)fprintf(stderr, "%s,",
|
||||||
file_fmttime(m->value.l, 0, tbuf));
|
file_fmttime(m->value.l, FILE_T_LOCAL, tbuf));
|
||||||
break;
|
break;
|
||||||
case FILE_QDATE:
|
case FILE_QDATE:
|
||||||
case FILE_LEQDATE:
|
case FILE_LEQDATE:
|
||||||
case FILE_BEQDATE:
|
case FILE_BEQDATE:
|
||||||
(void)fprintf(stderr, "%s,",
|
(void)fprintf(stderr, "%s,",
|
||||||
file_fmttime(m->value.q, FILE_T_LOCAL, tbuf));
|
file_fmttime(m->value.q, 0, tbuf));
|
||||||
break;
|
break;
|
||||||
case FILE_QLDATE:
|
case FILE_QLDATE:
|
||||||
case FILE_LEQLDATE:
|
case FILE_LEQLDATE:
|
||||||
case FILE_BEQLDATE:
|
case FILE_BEQLDATE:
|
||||||
(void)fprintf(stderr, "%s,",
|
(void)fprintf(stderr, "%s,",
|
||||||
file_fmttime(m->value.q, 0, tbuf));
|
file_fmttime(m->value.q, FILE_T_LOCAL, tbuf));
|
||||||
break;
|
break;
|
||||||
case FILE_QWDATE:
|
case FILE_QWDATE:
|
||||||
case FILE_LEQWDATE:
|
case FILE_LEQWDATE:
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#include "file.h"
|
#include "file.h"
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
FILE_RCSID("@(#)$File: readelf.c,v 1.120 2015/06/16 14:18:07 christos Exp $")
|
FILE_RCSID("@(#)$File: readelf.c,v 1.122 2015/09/10 13:59:32 christos Exp $")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BUILTIN_ELF
|
#ifdef BUILTIN_ELF
|
||||||
@@ -1052,11 +1052,14 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
|
|||||||
/* Things we can determine when we seek */
|
/* Things we can determine when we seek */
|
||||||
switch (xsh_type) {
|
switch (xsh_type) {
|
||||||
case SHT_NOTE:
|
case SHT_NOTE:
|
||||||
if (xsh_size + (uintmax_t)xsh_offset > (uintmax_t)fsize) {
|
if ((uintmax_t)(xsh_size + xsh_offset) >
|
||||||
|
(uintmax_t)fsize) {
|
||||||
if (file_printf(ms,
|
if (file_printf(ms,
|
||||||
", note offset/size 0x%jx+0x%jx exceeds"
|
", note offset/size 0x%" INTMAX_T_FORMAT
|
||||||
" file size 0x%jx", (uintmax_t)xsh_offset,
|
"x+0x%" INTMAX_T_FORMAT "x exceeds"
|
||||||
(uintmax_t)xsh_size, (uintmax_t)fsize) == -1)
|
" file size 0x%" INTMAX_T_FORMAT "x",
|
||||||
|
(uintmax_t)xsh_offset, (uintmax_t)xsh_size,
|
||||||
|
(uintmax_t)fsize) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1065,7 +1068,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
|
|||||||
" for note");
|
" for note");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (pread(fd, nbuf, xsh_size, xsh_offset) < (ssize_t)xsh_size) {
|
if (pread(fd, nbuf, xsh_size, xsh_offset) <
|
||||||
|
(ssize_t)xsh_size) {
|
||||||
file_badread(ms);
|
file_badread(ms);
|
||||||
free(nbuf);
|
free(nbuf);
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
#include "file.h"
|
#include "file.h"
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
FILE_RCSID("@(#)$File: softmagic.c,v 1.216 2015/06/09 22:17:52 christos Exp $")
|
FILE_RCSID("@(#)$File: softmagic.c,v 1.218 2015/09/11 17:24:09 christos Exp $")
|
||||||
#endif /* lint */
|
#endif /* lint */
|
||||||
|
|
||||||
#include "magic.h"
|
#include "magic.h"
|
||||||
@@ -63,6 +63,22 @@ private void cvt_32(union VALUETYPE *, const struct magic *);
|
|||||||
private void cvt_64(union VALUETYPE *, const struct magic *);
|
private void cvt_64(union VALUETYPE *, const struct magic *);
|
||||||
|
|
||||||
#define OFFSET_OOB(n, o, i) ((n) < (o) || (i) > ((n) - (o)))
|
#define OFFSET_OOB(n, o, i) ((n) < (o) || (i) > ((n) - (o)))
|
||||||
|
#define BE64(p) (((uint64_t)(p)->hq[0]<<56)|((uint64_t)(p)->hq[1]<<48)| \
|
||||||
|
((uint64_t)(p)->hq[2]<<40)|((uint64_t)(p)->hq[3]<<32)| \
|
||||||
|
((uint64_t)(p)->hq[4]<<24)|((uint64_t)(p)->hq[5]<<16)| \
|
||||||
|
((uint64_t)(p)->hq[6]<<8)|((uint64_t)(p)->hq[7]))
|
||||||
|
#define LE64(p) (((uint64_t)(p)->hq[7]<<56)|((uint64_t)(p)->hq[6]<<48)| \
|
||||||
|
((uint64_t)(p)->hq[5]<<40)|((uint64_t)(p)->hq[4]<<32)| \
|
||||||
|
((uint64_t)(p)->hq[3]<<24)|((uint64_t)(p)->hq[2]<<16)| \
|
||||||
|
((uint64_t)(p)->hq[1]<<8)|((uint64_t)(p)->hq[0]))
|
||||||
|
#define LE32(p) (((uint32_t)(p)->hl[3]<<24)|((uint32_t)(p)->hl[2]<<16)| \
|
||||||
|
((uint32_t)(p)->hl[1]<<8)|((uint32_t)(p)->hl[0]))
|
||||||
|
#define BE32(p) (((uint32_t)(p)->hl[0]<<24)|((uint32_t)(p)->hl[1]<<16)| \
|
||||||
|
((uint32_t)(p)->hl[2]<<8)|((uint32_t)(p)->hl[3]))
|
||||||
|
#define ME32(p) (((uint32_t)(p)->hl[1]<<24)|((uint32_t)(p)->hl[0]<<16)| \
|
||||||
|
((uint32_t)(p)->hl[3]<<8)|((uint32_t)(p)->hl[2]))
|
||||||
|
#define BE16(p) (((uint16_t)(p)->hs[0]<<8)|((uint16_t)(p)->hs[1]))
|
||||||
|
#define LE16(p) (((uint16_t)(p)->hs[1]<<8)|((uint16_t)(p)->hs[0]))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* softmagic - lookup one file in parsed, in-memory copy of database
|
* softmagic - lookup one file in parsed, in-memory copy of database
|
||||||
@@ -962,84 +978,65 @@ mconvert(struct magic_set *ms, struct magic *m, int flip)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
case FILE_BESHORT:
|
case FILE_BESHORT:
|
||||||
p->h = (short)((p->hs[0]<<8)|(p->hs[1]));
|
p->h = (short)BE16(p);
|
||||||
cvt_16(p, m);
|
cvt_16(p, m);
|
||||||
return 1;
|
return 1;
|
||||||
case FILE_BELONG:
|
case FILE_BELONG:
|
||||||
case FILE_BEDATE:
|
case FILE_BEDATE:
|
||||||
case FILE_BELDATE:
|
case FILE_BELDATE:
|
||||||
p->l = (int32_t)
|
p->l = (int32_t)BE32(p);
|
||||||
((p->hl[0]<<24)|(p->hl[1]<<16)|(p->hl[2]<<8)|(p->hl[3]));
|
|
||||||
cvt_32(p, m);
|
cvt_32(p, m);
|
||||||
return 1;
|
return 1;
|
||||||
case FILE_BEQUAD:
|
case FILE_BEQUAD:
|
||||||
case FILE_BEQDATE:
|
case FILE_BEQDATE:
|
||||||
case FILE_BEQLDATE:
|
case FILE_BEQLDATE:
|
||||||
case FILE_BEQWDATE:
|
case FILE_BEQWDATE:
|
||||||
p->q = (uint64_t)
|
p->q = (uint64_t)BE64(p);
|
||||||
(((uint64_t)p->hq[0]<<56)|((uint64_t)p->hq[1]<<48)|
|
|
||||||
((uint64_t)p->hq[2]<<40)|((uint64_t)p->hq[3]<<32)|
|
|
||||||
((uint64_t)p->hq[4]<<24)|((uint64_t)p->hq[5]<<16)|
|
|
||||||
((uint64_t)p->hq[6]<<8)|((uint64_t)p->hq[7]));
|
|
||||||
cvt_64(p, m);
|
cvt_64(p, m);
|
||||||
return 1;
|
return 1;
|
||||||
case FILE_LESHORT:
|
case FILE_LESHORT:
|
||||||
p->h = (short)((p->hs[1]<<8)|(p->hs[0]));
|
p->h = (short)LE16(p);
|
||||||
cvt_16(p, m);
|
cvt_16(p, m);
|
||||||
return 1;
|
return 1;
|
||||||
case FILE_LELONG:
|
case FILE_LELONG:
|
||||||
case FILE_LEDATE:
|
case FILE_LEDATE:
|
||||||
case FILE_LELDATE:
|
case FILE_LELDATE:
|
||||||
p->l = (int32_t)
|
p->l = (int32_t)LE32(p);
|
||||||
((p->hl[3]<<24)|(p->hl[2]<<16)|(p->hl[1]<<8)|(p->hl[0]));
|
|
||||||
cvt_32(p, m);
|
cvt_32(p, m);
|
||||||
return 1;
|
return 1;
|
||||||
case FILE_LEQUAD:
|
case FILE_LEQUAD:
|
||||||
case FILE_LEQDATE:
|
case FILE_LEQDATE:
|
||||||
case FILE_LEQLDATE:
|
case FILE_LEQLDATE:
|
||||||
case FILE_LEQWDATE:
|
case FILE_LEQWDATE:
|
||||||
p->q = (uint64_t)
|
p->q = (uint64_t)LE64(p);
|
||||||
(((uint64_t)p->hq[7]<<56)|((uint64_t)p->hq[6]<<48)|
|
|
||||||
((uint64_t)p->hq[5]<<40)|((uint64_t)p->hq[4]<<32)|
|
|
||||||
((uint64_t)p->hq[3]<<24)|((uint64_t)p->hq[2]<<16)|
|
|
||||||
((uint64_t)p->hq[1]<<8)|((uint64_t)p->hq[0]));
|
|
||||||
cvt_64(p, m);
|
cvt_64(p, m);
|
||||||
return 1;
|
return 1;
|
||||||
case FILE_MELONG:
|
case FILE_MELONG:
|
||||||
case FILE_MEDATE:
|
case FILE_MEDATE:
|
||||||
case FILE_MELDATE:
|
case FILE_MELDATE:
|
||||||
p->l = (int32_t)
|
p->l = (int32_t)ME32(p);
|
||||||
((p->hl[1]<<24)|(p->hl[0]<<16)|(p->hl[3]<<8)|(p->hl[2]));
|
|
||||||
cvt_32(p, m);
|
cvt_32(p, m);
|
||||||
return 1;
|
return 1;
|
||||||
case FILE_FLOAT:
|
case FILE_FLOAT:
|
||||||
cvt_float(p, m);
|
cvt_float(p, m);
|
||||||
return 1;
|
return 1;
|
||||||
case FILE_BEFLOAT:
|
case FILE_BEFLOAT:
|
||||||
p->l = ((uint32_t)p->hl[0]<<24)|((uint32_t)p->hl[1]<<16)|
|
p->l = BE32(p);
|
||||||
((uint32_t)p->hl[2]<<8) |((uint32_t)p->hl[3]);
|
|
||||||
cvt_float(p, m);
|
cvt_float(p, m);
|
||||||
return 1;
|
return 1;
|
||||||
case FILE_LEFLOAT:
|
case FILE_LEFLOAT:
|
||||||
p->l = ((uint32_t)p->hl[3]<<24)|((uint32_t)p->hl[2]<<16)|
|
p->l = LE32(p);
|
||||||
((uint32_t)p->hl[1]<<8) |((uint32_t)p->hl[0]);
|
|
||||||
cvt_float(p, m);
|
cvt_float(p, m);
|
||||||
return 1;
|
return 1;
|
||||||
case FILE_DOUBLE:
|
case FILE_DOUBLE:
|
||||||
cvt_double(p, m);
|
cvt_double(p, m);
|
||||||
return 1;
|
return 1;
|
||||||
case FILE_BEDOUBLE:
|
case FILE_BEDOUBLE:
|
||||||
p->q = ((uint64_t)p->hq[0]<<56)|((uint64_t)p->hq[1]<<48)|
|
p->q = BE64(p);
|
||||||
((uint64_t)p->hq[2]<<40)|((uint64_t)p->hq[3]<<32)|
|
|
||||||
((uint64_t)p->hq[4]<<24)|((uint64_t)p->hq[5]<<16)|
|
|
||||||
((uint64_t)p->hq[6]<<8) |((uint64_t)p->hq[7]);
|
|
||||||
cvt_double(p, m);
|
cvt_double(p, m);
|
||||||
return 1;
|
return 1;
|
||||||
case FILE_LEDOUBLE:
|
case FILE_LEDOUBLE:
|
||||||
p->q = ((uint64_t)p->hq[7]<<56)|((uint64_t)p->hq[6]<<48)|
|
p->q = LE64(p);
|
||||||
((uint64_t)p->hq[5]<<40)|((uint64_t)p->hq[4]<<32)|
|
|
||||||
((uint64_t)p->hq[3]<<24)|((uint64_t)p->hq[2]<<16)|
|
|
||||||
((uint64_t)p->hq[1]<<8) |((uint64_t)p->hq[0]);
|
|
||||||
cvt_double(p, m);
|
cvt_double(p, m);
|
||||||
return 1;
|
return 1;
|
||||||
case FILE_REGEX:
|
case FILE_REGEX:
|
||||||
@@ -1105,6 +1102,8 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
|
|||||||
|
|
||||||
if (bytecnt == 0 || bytecnt > nbytes - offset)
|
if (bytecnt == 0 || bytecnt > nbytes - offset)
|
||||||
bytecnt = nbytes - offset;
|
bytecnt = nbytes - offset;
|
||||||
|
if (bytecnt > ms->regex_max)
|
||||||
|
bytecnt = ms->regex_max;
|
||||||
|
|
||||||
buf = RCAST(const char *, s) + offset;
|
buf = RCAST(const char *, s) + offset;
|
||||||
end = last = RCAST(const char *, s) + bytecnt + offset;
|
end = last = RCAST(const char *, s) + bytecnt + offset;
|
||||||
@@ -1239,27 +1238,24 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
|||||||
off = q->h;
|
off = q->h;
|
||||||
break;
|
break;
|
||||||
case FILE_BESHORT:
|
case FILE_BESHORT:
|
||||||
off = (short)((q->hs[0]<<8)|(q->hs[1]));
|
off = (short)BE16(q);
|
||||||
break;
|
break;
|
||||||
case FILE_LESHORT:
|
case FILE_LESHORT:
|
||||||
off = (short)((q->hs[1]<<8)|(q->hs[0]));
|
off = (short)LE16(q);
|
||||||
break;
|
break;
|
||||||
case FILE_LONG:
|
case FILE_LONG:
|
||||||
off = q->l;
|
off = q->l;
|
||||||
break;
|
break;
|
||||||
case FILE_BELONG:
|
case FILE_BELONG:
|
||||||
case FILE_BEID3:
|
case FILE_BEID3:
|
||||||
off = (int32_t)((q->hl[0]<<24)|(q->hl[1]<<16)|
|
off = (int32_t)BE32(q);
|
||||||
(q->hl[2]<<8)|(q->hl[3]));
|
|
||||||
break;
|
break;
|
||||||
case FILE_LEID3:
|
case FILE_LEID3:
|
||||||
case FILE_LELONG:
|
case FILE_LELONG:
|
||||||
off = (int32_t)((q->hl[3]<<24)|(q->hl[2]<<16)|
|
off = (int32_t)LE32(q);
|
||||||
(q->hl[1]<<8)|(q->hl[0]));
|
|
||||||
break;
|
break;
|
||||||
case FILE_MELONG:
|
case FILE_MELONG:
|
||||||
off = (int32_t)((q->hl[1]<<24)|(q->hl[0]<<16)|
|
off = (int32_t)ME32(q);
|
||||||
(q->hl[3]<<8)|(q->hl[2]));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||||
@@ -1413,8 +1409,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
|||||||
case FILE_BEID3:
|
case FILE_BEID3:
|
||||||
if (OFFSET_OOB(nbytes, offset, 4))
|
if (OFFSET_OOB(nbytes, offset, 4))
|
||||||
return 0;
|
return 0;
|
||||||
lhs = (p->hl[0] << 24) | (p->hl[1] << 16) |
|
lhs = BE32(p);
|
||||||
(p->hl[2] << 8) | p->hl[3];
|
|
||||||
if (off) {
|
if (off) {
|
||||||
switch (m->in_op & FILE_OPS_MASK) {
|
switch (m->in_op & FILE_OPS_MASK) {
|
||||||
case FILE_OPAND:
|
case FILE_OPAND:
|
||||||
@@ -1451,8 +1446,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
|||||||
case FILE_LEID3:
|
case FILE_LEID3:
|
||||||
if (OFFSET_OOB(nbytes, offset, 4))
|
if (OFFSET_OOB(nbytes, offset, 4))
|
||||||
return 0;
|
return 0;
|
||||||
lhs = (p->hl[3] << 24) | (p->hl[2] << 16) |
|
lhs = LE32(p);
|
||||||
(p->hl[1] << 8) | p->hl[0];
|
|
||||||
if (off) {
|
if (off) {
|
||||||
switch (m->in_op & FILE_OPS_MASK) {
|
switch (m->in_op & FILE_OPS_MASK) {
|
||||||
case FILE_OPAND:
|
case FILE_OPAND:
|
||||||
@@ -1488,8 +1482,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
|||||||
case FILE_MELONG:
|
case FILE_MELONG:
|
||||||
if (OFFSET_OOB(nbytes, offset, 4))
|
if (OFFSET_OOB(nbytes, offset, 4))
|
||||||
return 0;
|
return 0;
|
||||||
lhs = (p->hl[1] << 24) | (p->hl[0] << 16) |
|
lhs = ME32(p);
|
||||||
(p->hl[3] << 8) | p->hl[2];
|
|
||||||
if (off) {
|
if (off) {
|
||||||
switch (m->in_op & FILE_OPS_MASK) {
|
switch (m->in_op & FILE_OPS_MASK) {
|
||||||
case FILE_OPAND:
|
case FILE_OPAND:
|
||||||
|
|||||||
@@ -290,7 +290,7 @@
|
|||||||
#define PACKAGE_NAME "file"
|
#define PACKAGE_NAME "file"
|
||||||
|
|
||||||
/* Define to the full name and version of this package. */
|
/* Define to the full name and version of this package. */
|
||||||
#define PACKAGE_STRING "file 5.24"
|
#define PACKAGE_STRING "file 5.25"
|
||||||
|
|
||||||
/* Define to the one symbol short name of this package. */
|
/* Define to the one symbol short name of this package. */
|
||||||
#define PACKAGE_TARNAME "file"
|
#define PACKAGE_TARNAME "file"
|
||||||
@@ -299,7 +299,7 @@
|
|||||||
#define PACKAGE_URL ""
|
#define PACKAGE_URL ""
|
||||||
|
|
||||||
/* Define to the version of this package. */
|
/* Define to the version of this package. */
|
||||||
#define PACKAGE_VERSION "5.24"
|
#define PACKAGE_VERSION "5.25"
|
||||||
|
|
||||||
/* Define to 1 if you have the ANSI C header files. */
|
/* Define to 1 if you have the ANSI C header files. */
|
||||||
#define STDC_HEADERS 1
|
#define STDC_HEADERS 1
|
||||||
@@ -330,7 +330,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Version number of package */
|
/* Version number of package */
|
||||||
#define VERSION "5.24"
|
#define VERSION "5.25"
|
||||||
|
|
||||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
||||||
significant byte first (like Motorola and SPARC, unlike Intel). */
|
significant byte first (like Motorola and SPARC, unlike Intel). */
|
||||||
|
|||||||
Reference in New Issue
Block a user