diff options
30 files changed, 397 insertions, 92 deletions
diff --git a/contrib/file/Magdir/archive b/contrib/file/Magdir/archive index ac3da71..133e50c 100644 --- a/contrib/file/Magdir/archive +++ b/contrib/file/Magdir/archive @@ -231,10 +231,10 @@ 2 string -pms- PMarc SFX archive (CP/M, DOS) 5 string -pc1- PopCom compressed executable (CP/M) -# From rafael@icp.inpg.fr (Rafael Laboissiere) +# From Rafael Laboissiere <rafael@laboissiere.net> # The Project Revision Control System (see -# http://www.XCF.Berkeley.EDU/~jmacd/prcs.html) generates a packaged project -# file which is recognized by the following entry: +# http://prcs.sourceforge.net) generates a packaged project +# file which is recognized by the following entry: 0 leshort 0xeb81 PRCS packaged project # Microsoft cabinets diff --git a/contrib/file/Magdir/audio b/contrib/file/Magdir/audio index 5a16971..9507c12 100644 --- a/contrib/file/Magdir/audio +++ b/contrib/file/Magdir/audio @@ -157,7 +157,90 @@ # Impuse tracker module (audio/x-it) 0 string IMPM Impulse Tracker module sound data - >4 string >\0 "%s" +>40 leshort !0 compatible w/ITv%x +>42 leshort !0 created w/ITv%x # Imago Orpheus module (audio/x-imf) 60 string IM10 Imago Orpheus module sound data - >0 string >\0 "%s" + +# From <collver1@attbi.com> +# These are the /etc/magic entries to decode modules, instruments, and +# samples in Impulse Tracker's native format. + +0 string IMPS Impulse Tracker Sample +>18 byte &2 16 bit +>18 byte ^2 8 bit +>18 byte &4 stereo +>18 byte ^4 mono +0 string IMPI Impulse Tracker Instrument +>28 leshort !0 ITv%x +>30 byte !0 %d samples + +# Yamaha TX Wave: file(1) magic for Yamaha TX Wave audio files +# From <collver1@attbi.com> +0 string LM8953 Yamaha TX Wave +>22 byte 0x49 looped +>22 byte 0xC9 non-looped +>23 byte 1 33kHz +>23 byte 2 50kHz +>23 byte 3 16kHz + +# scream tracker: file(1) magic for Scream Tracker sample files +# +# From <collver1@attbi.com> +76 string SCRS Scream Tracker Sample +>0 byte 1 sample +>0 byte 2 adlib melody +>0 byte >2 adlib drum +>31 byte &2 stereo +>31 byte ^2 mono +>31 byte &4 16bit little endian +>31 byte ^4 8bit +>30 byte 0 unpacked +>30 byte 1 packed + +# audio +# From: Cory Dikkers <cdikkers@swbell.net> +0 string MMD0 MED music file, version 0 +0 string MMD1 OctaMED Pro music file, version 1 +0 string MMD3 OctaMED Soundstudio music file, version 3 +0 string OctaMEDCmpr OctaMED Soundstudio compressed file +0 string MED MED_Song +0 string SymM Symphonie SymMOD music file +# +0 string THX AHX version +>3 byte =0 1 module data +>3 byte =1 2 module data +# +0 string OKTASONG Oktalyzer module data +# +0 string DIGI\ Booster\ module\0 %s +>20 byte >0 %c +>>21 byte >0 \b%c +>>>22 byte >0 \b%c +>>>>23 byte >0 \b%c +>610 string >\0 \b, "%s" +# +0 string DBM0 DIGI Booster Pro Module +>4 byte >0 V%X. +>>5 byte x \b%02X +>16 string >\0 \b, "%s" +# +0 string FTMN FaceTheMusic module +>16 string >\0d \b, "%s" + +# From: Takeshi Hamasaki <hma@syd.odn.ne.jp> +# NOA Nancy Codec file +0 string \210NOA\015\012\032 NOA Nancy Codec Movie file +# Yamaha SMAF format +0 string MMMD Yamaha SMAF file +# Sharp Jisaku Melody format for PDC +0 string \001Sharp\040JisakuMelody SHARP Cell-Phone ringing Melody +>20 string Ver01.00 Ver. 1.00 +>>32 byte x , %d tracks + +# FLAC audio stream <URL:http://flac.sourceforge.net/> +# From: Dan Fandrich <dan@coneharvesters.com> +0 string fLaC FLAC audio stream data + diff --git a/contrib/file/Magdir/compress b/contrib/file/Magdir/compress index 3da7f5f..0130541 100644 --- a/contrib/file/Magdir/compress +++ b/contrib/file/Magdir/compress @@ -152,3 +152,20 @@ # 4.3BSD-Quasijarus Strong Compression # http://minnie.tuhs.org/Quasijarus/compress.html 0 string \037\241 Quasijarus strong compressed data + +# From: Cory Dikkers <cdikkers@swbell.net> +0 string XPKF Amiga xpkf.library compressed data +0 string PP11 Power Packer 1.1 compressed data +0 string PP20 Power Packer 2.0 compressed data, +>4 belong 0x09090909 fast compression +>4 belong 0x090A0A0A mediocre compression +>4 belong 0x090A0B0B good compression +>4 belong 0x090A0C0C very good compression +>4 belong 0x090A0C0D best compression + +# 7z archiver, from Thomas Klausner (wiz@danbala.tuwien.ac.at) +# http://www.7-zip.org or DOC/7zFormat.txt +# +0 string 7z\274\257\047\034 7z archive data, +>6 byte x version %d +>7 byte x \b.%d diff --git a/contrib/file/Magdir/ctags b/contrib/file/Magdir/ctags index 8d43971..5c039e7 100644 --- a/contrib/file/Magdir/ctags +++ b/contrib/file/Magdir/ctags @@ -2,4 +2,4 @@ # ---------------------------------------------------------------------------- # ctags: file (1) magic for Exuberant Ctags files # From: Alexander Mai <mai@migdal.ikp.physik.tu-darmstadt.de> -0 string !_TAG Exuberant Ctags tag file +0 string !_TAG Exuberant Ctags tag file text diff --git a/contrib/file/Magdir/filesystems b/contrib/file/Magdir/filesystems index 1e6624c..712f3e4 100644 --- a/contrib/file/Magdir/filesystems +++ b/contrib/file/Magdir/filesystems @@ -25,33 +25,108 @@ >512 belong&077777777 0600407 \b, boot block present 0x1FE leshort 0xAA55 x86 boot sector >2 string OSBS \b, OS/BS MBR -# J\xf6rg Jenderek <joerg@pcialias.localnet> +# J\xf6rg Jenderek <joerg.jenderek@gmx.net> >0x8C string Invalid\ partition\ table \b, MS-DOS MBR >0x9D string Invalid\ partition\ table \b, DR-DOS MBR, version 7.01 to 7.03 >0x10F string Ung\201ltige\ Partitionstabelle \b, MS-DOS MBR, german version 4.10.1998, 4.10.2222 >0x8B string Ung\201ltige\ Partitionstabelle \b, MS-DOS MBR, german version 5.00 to 4.00.950 >0x145 string Default:\ F \b, FREE-DOS MBR >0 string \0\0\0\0 \b, extended partition table ->0 leshort 0x3CEB \b, system ->>3 string >\0 %s ->>0x36 string FAT \b, %s ->>>0x39 string 12 (%s bit) ->>>0x39 string 16 (%s bit) ->0x52 string FAT32 \b, FAT (32 bit) ->>>43 string >NO\ NAME label: %.11s, ->>>43 string <NO\ NAME label: %.11s, ->>>43 string NO\ NAME unlabeled, ->>>19 leshort >0 %d sectors ->>>19 leshort 0 ->>>>32 lelong x %d sectors +# JuMP short bootcodeoffset NOP assembler instructions will usually be EB xx 90 +# older drives may use E9 xx xx +>0 lelong&0x009000EB 0x009000EB +>0 lelong&0x000000E9 0x000000E9 +>>1 ubyte >37 \b, code offset 0x%x +# mtools-3.9.8/msdos.h +# usual values are marked with comments to get only informations of strange FAT systems +# valid sectorsize are from 32 to 2048 +>>>11 uleshort <2049 +>>>>11 uleshort >31 +>>>>>3 string >\0 \b, OEM-ID "%8.8s" +>>>>>11 uleshort >512 \b, Bytes/sector %u +#>>>>>11 uleshort =512 \b, Bytes/sector %u=512 (usual) +>>>>>11 uleshort <512 \b, Bytes/sector %u +>>>>>13 ubyte >1 \b, sectors/cluster %u +#>>>>>13 ubyte =1 \b, sectors/cluster %u (usual on Floppies) +>>>>>14 uleshort >32 \b, reserved sectors %u +#>>>>>14 uleshort =32 \b, reserved sectors %u (usual Fat32) +#>>>>>14 uleshort >1 \b, reserved sectors %u +#>>>>>14 uleshort =1 \b, reserved sectors %u (usual FAT12,FAT16) +>>>>>14 uleshort <1 \b, reserved sectors %u +>>>>>16 ubyte >2 \b, FATs %u +#>>>>>16 ubyte =2 \b, FATs %u (usual) +>>>>>16 ubyte =1 \b, FAT %u +>>>>>16 ubyte >0 +>>>>>17 uleshort >0 \b, root entries %u +#>>>>>17 uleshort =0 \b, root entries %u=0 (usual Fat32) +>>>>>19 uleshort >0 \b, sectors %u (volumes <=32 MB) +#>>>>>19 uleshort =0 \b, sectors %u=0 (usual Fat32) +>>>>>21 ubyte >0xF0 \b, Media descriptor 0x%x +#>>>>>21 ubyte =0xF0 \b, Media descriptor 0x%x (usual floppy) +>>>>>21 ubyte <0xF0 \b, Media descriptor 0x%x +>>>>>22 uleshort >0 \b, sectors/FAT %u +#>>>>>22 uleshort =0 \b, sectors/FAT %u=0 (usual Fat32) +>>>>>26 ubyte >2 \b, heads %u +#>>>>>26 ubyte =2 \b, heads %u (usual floppy) +>>>>>26 ubyte =1 \b, heads %u +>>>>>28 ulelong >0 \b, hidden sectors %u +#>>>>>28 ulelong =0 \b, hidden sectors %u (usual floppy) +>>>>>32 ulelong >0 \b, sectors %u (volumes > 32 MB) +#>>>>>32 ulelong =0 \b, sectors %u (volumes > 32 MB) +# FAT<32 specific +# NOT le FAT3=NOT 3TAF=0xCCABBEB9 +>>>>>82 ulelong&0xCCABBEB9 >0 +>>>>>>36 ubyte >0x80 \b, physical drive 0x%x +#>>>>>>36 ubyte =0x80 \b, physical drive 0x%x=0x80 (usual harddisk) +>>>>>>36 ubyte&0x7F >0 \b, physical drive 0x%x +#>>>>>>36 ubyte =0 \b, physical drive 0x%x=0 (usual floppy) +>>>>>>37 ubyte >0 \b, reserved 0x%x +#>>>>>>37 ubyte =0 \b, reserved 0x%x +>>>>>>38 ubyte >0x29 \b, dos < 4.0 BootSector (0x%x) +>>>>>>38 ubyte <0x29 \b, dos < 4.0 BootSector (0x%x) +>>>>>>38 ubyte =0x29 +>>>>>>>39 ulelong x \b, serial number 0x%x +>>>>>>>43 string <NO\ NAME \b, label: "%11.11s" +>>>>>>>43 string >NO\ NAME \b, label: "%11.11s" +>>>>>>>43 string =NO\ NAME \b, unlabeled +>>>>>>54 string FAT1 \b, FAT +>>>>>>>54 string FAT12 \b (12 bit) +>>>>>>>54 string FAT16 \b (16 bit) +# FAT32 specific +>>>>>82 string FAT32 \b, FAT (32 bit) +>>>>>>36 ulelong x \b, sectors/FAT %u +>>>>>>40 uleshort >0 \b, extension flags %u +#>>>>>>40 uleshort =0 \b, extension flags %u +>>>>>>42 uleshort >0 \b, fsVersion %u +#>>>>>>42 uleshort =0 \b, fsVersion %u (usual) +>>>>>>44 ulelong >2 \b, rootdir cluster %u +#>>>>>>44 ulelong =2 \b, rootdir cluster %u +#>>>>>>44 ulelong =1 \b, rootdir cluster %u +>>>>>>48 uleshort >1 \b, infoSector %u +#>>>>>>48 uleshort =1 \b, infoSector %u (usual) +>>>>>>48 uleshort <1 \b, infoSector %u +>>>>>>50 uleshort >6 \b, Backup boot sector %u +#>>>>>>50 uleshort =6 \b, Backup boot sector %u (usual) +>>>>>>50 uleshort <6 \b, Backup boot sector %u +>>>>>>54 ulelong >0 \b, reserved1 0x%x +>>>>>>58 ulelong >0 \b, reserved2 0x%x +>>>>>>62 ulelong >0 \b, reserved3 0x%x +# same structure as FAT1X +>>>>>>64 ubyte >0x80 \b, physical drive 0x%x +#>>>>>>64 ubyte =0x80 \b, physical drive 0x%x=80 (usual harddisk) +>>>>>>64 ubyte&0x7F >0 \b, physical drive 0x%x +#>>>>>>64 ubyte =0 \b, physical drive 0x%x=0 (usual floppy) +>>>>>>65 ubyte >0 \b, reserved 0x%x +>>>>>>66 ubyte >0x29 \b, dos < 4.0 BootSector (0x%x) +>>>>>>66 ubyte <0x29 \b, dos < 4.0 BootSector (0x%x) +>>>>>>66 ubyte =0x29 +>>>>>>>67 ulelong x \b, serial number 0x%x +>>>>>>>71 string <NO\ NAME \b, label: "%11.11s" +>>>>>>71 string >NO\ NAME \b, label: "%11.11s" +>>>>>>71 string =NO\ NAME \b, unlabeled +### FATs end >0x200 lelong 0x82564557 \b, BSD disklabel -# Solaris 7 FAT12 floppies J\xf6rg Jenderek <joerg@pcialias.localnet> ->0 leshort 0x7AEB \b, system ->>3 string >\0 %s ->>0x36 string FAT \b, %s ->>>0x39 string 12 (%s bit) - # Minix filesystems - Juan Cespedes <cespedes@debian.org> 0x410 leshort 0x137f Minix filesystem 0x410 beshort 0x137f Minix filesystem (big endian), diff --git a/contrib/file/Magdir/flash b/contrib/file/Magdir/flash index 1d6f7b7..0db9bfe 100644 --- a/contrib/file/Magdir/flash +++ b/contrib/file/Magdir/flash @@ -8,3 +8,6 @@ # 0 string FWS Macromedia Flash data, >3 byte x version %d +# +# From Dave Wilson +0 string AGD4\xbe\xb8\xbb\xcb\x00 Macromedia Freehand 9 Document diff --git a/contrib/file/Magdir/gringotts b/contrib/file/Magdir/gringotts index 2d135f8..6e833a3 100644 --- a/contrib/file/Magdir/gringotts +++ b/contrib/file/Magdir/gringotts @@ -3,10 +3,12 @@ # gringotts: file(1) magic for Gringotts # http://devel.pluto.linux.it/projects/Gringotts/ # author: Germano Rizzo <mano@pluto.linux.it> -#GRG2????Y +#GRG3????Y 0 string GRG Gringotts data file ->3 string 1 v.1, SERPENT crypt, SHA-256 hash, ZLib lvl.9 ->3 string 2 v.2, +#file format 1 +>3 string 1 v.1, MCRYPT S2K, SERPENT crypt, SHA-256 hash, ZLib lvl.9 +#file format 2 +>3 string 2 v.2, MCRYPT S2K, >>8 byte&0x70 0x00 RIJNDAEL-128 crypt, >>8 byte&0x70 0x10 SERPENT crypt, >>8 byte&0x70 0x20 TWOFISH crypt, @@ -23,3 +25,23 @@ >>8 byte&0x03 0x01 lvl.3 >>8 byte&0x03 0x02 lvl.6 >>8 byte&0x03 0x03 lvl.9 +#file format 3 +>3 string 3 v.3, OpenPGP S2K, +>>8 byte&0x70 0x00 RIJNDAEL-128 crypt, +>>8 byte&0x70 0x10 SERPENT crypt, +>>8 byte&0x70 0x20 TWOFISH crypt, +>>8 byte&0x70 0x30 CAST-256 crypt, +>>8 byte&0x70 0x40 SAFER+ crypt, +>>8 byte&0x70 0x50 LOKI97 crypt, +>>8 byte&0x70 0x60 3DES crypt, +>>8 byte&0x70 0x70 RIJNDAEL-256 crypt, +>>8 byte&0x08 0x00 SHA1 hash, +>>8 byte&0x08 0x08 RIPEMD-160 hash, +>>8 byte&0x04 0x00 ZLib +>>8 byte&0x04 0x04 BZip2 +>>8 byte&0x03 0x00 lvl.0 +>>8 byte&0x03 0x01 lvl.3 +>>8 byte&0x03 0x02 lvl.6 +>>8 byte&0x03 0x03 lvl.9 +#file format >3 +>3 string >3 v.%.1s (unknown details) diff --git a/contrib/file/Magdir/hp b/contrib/file/Magdir/hp index 60574b5..052f09a 100644 --- a/contrib/file/Magdir/hp +++ b/contrib/file/Magdir/hp @@ -389,3 +389,7 @@ >>>>>>>>>0xC4 belong 12 - received SIGSYS >>>>>>>>>0xC4 belong 33 - received SIGXCPU >>>>>>>>>0xC4 belong 34 - received SIGXFSZ + +# From: AMAKAWA Shuhei <sa264@cam.ac.uk> +0 string HPHP49- HP49 binary + diff --git a/contrib/file/Magdir/images b/contrib/file/Magdir/images index daddc41..27a38eb 100644 --- a/contrib/file/Magdir/images +++ b/contrib/file/Magdir/images @@ -142,6 +142,9 @@ 1 string PC\ Research,\ Inc group 3 fax data >29 byte 0 \b, normal resolution (204x98 DPI) >29 byte 1 \b, fine resolution (204x196 DPI) +# From: Herbert Rosmanith <herp@wildsau.idv.uni.linz.at> +0 string Sfff structured fax file + # PC bitmaps (OS/2, Windoze BMP files) (Greg Roelofs, newt@uchicago.edu) 0 string BM PC bitmap data @@ -333,3 +336,26 @@ # of various EPOC file formats 0 string \x37\x00\x00\x10\x42\x00\x00\x10\x00\x00\x00\x00\x39\x64\x39\x47 EPOC MBM image file + +# PCX image files +# From: Dan Fandrich <dan@coneharvesters.com> +0 beshort 0x0a00 PCX ver. 2.5 image data +0 beshort 0x0a02 PCX ver. 2.8 image data, with palette +0 beshort 0x0a03 PCX ver. 2.8 image data, without palette +0 beshort 0x0a04 PCX for Windows image data +0 beshort 0x0a05 PCX ver. 3.0 image data +>4 leshort x bounding box [%hd, +>6 leshort x %hd] - +>8 leshort x [%hd, +>10 leshort x %hd], +>65 byte >1 %d planes each of +>3 byte x %hhd-bit +>68 byte 0 image, +>68 byte 1 colour, +>68 byte 2 grayscale, +>68 byte >2 image, +>68 byte <0 image, +>12 leshort >0 %hd x +>>14 leshort x %hd dpi, +>2 byte 0 uncompressed +>2 byte 1 RLE compressed diff --git a/contrib/file/Magdir/lisp b/contrib/file/Magdir/lisp index 11f33cd..42698c0 100644 --- a/contrib/file/Magdir/lisp +++ b/contrib/file/Magdir/lisp @@ -27,3 +27,6 @@ #.com and .bin for MIT scheme 0 string \372\372\372\372 MIT scheme (library?) + +# From: David Allouche <david@allouche.net> +0 string \<TeXmacs| TeXmacs document text diff --git a/contrib/file/Magdir/msdos b/contrib/file/Magdir/msdos index 771a8fd..99f1109 100644 --- a/contrib/file/Magdir/msdos +++ b/contrib/file/Magdir/msdos @@ -90,6 +90,8 @@ >>122 string Windows\ self-extracting\ ZIP \b, %s >0x1c string RJSX\xff\xff \b, ARJ SFX >0x1c string diet\xf9\x9c \b, diet compressed +>0x1c string LZ09 \b, LZEXE v0.90 compressed +>0x1c string LZ91 \b, LZEXE v0.91 compressed >0x1e string Copyright\ 1989-1990\ PKWARE\ Inc. \b, PKSFX # JM: 0x1e "PKLITE Copr. 1990-92 PKWARE Inc. All Rights Reserved\7\0\0\0" >0x1e string PKLITE\ Copr. \b, %.6s compressed diff --git a/contrib/file/Magdir/python b/contrib/file/Magdir/python index 2e7bbe7..1932fd2 100644 --- a/contrib/file/Magdir/python +++ b/contrib/file/Magdir/python @@ -1,5 +1,14 @@ + +#------------------------------------------------------------------------------ +# python: file(1) magic for python +# +# From: David Necas <yeti@physics.muni.cz> # often the module starts with a multiline string 0 string """ a python script text executable -# MAGIC as specified in Python/import.c (1.5.2/1.6) +# MAGIC as specified in Python/import.c (1.5 to 2.3.0a) # 20121 ( YEAR - 1995 ) + MONTH + DAY (little endian followed by "\r\n" -0 belong 0x994e0d0a python compiled +0 belong 0x994e0d0a python 1.5/1.6 byte-compiled +0 belong 0x87c60d0a python 2.0 byte-compiled +0 belong 0x2aeb0d0a python 2.1 byte-compiled +0 belong 0x2ded0d0a python 2.2 byte-compiled +#0 belong 0x31f20d0a python 2.3 byte-compiled diff --git a/contrib/file/Magdir/sgml b/contrib/file/Magdir/sgml index e831c3c..55b8301 100644 --- a/contrib/file/Magdir/sgml +++ b/contrib/file/Magdir/sgml @@ -5,16 +5,23 @@ # from Daniel Quinlan (quinlan@yggdrasil.com) # adapted to string extenstions by Anthon van der Neut <anthon@mnt.org) 0 string/cB \<!doctype\ html HTML document text -0 string/c \<head HTML document text -0 string/c \<title HTML document text -0 string/c \<html HTML document text +0 string/cb \<head HTML document text +0 string/cb \<title HTML document text +0 string/cb \<html HTML document text # Extensible markup language (XML), a subset of SGML # from Marc Prud'hommeaux (marc@apocalypse.org) -0 string/c \<?xml XML document text +0 string/cb \<?xml XML document text # SGML, mostly from rph@sq -0 string/c \<!doctype exported SGML document text -0 string/c \<!subdoc exported SGML subdocument text -0 string \<!-- exported SGML document text +0 string/cb \<!doctype exported SGML document text +0 string/cb \<!subdoc exported SGML subdocument text +0 string/cb \<!-- exported SGML document text + +# Web browser cookie files +# (Mozilla, Galeon, Netscape 4, Konqueror..) +# Ulf Harnhammar <ulfh@update.uu.se> +0 string #\ HTTP\ Cookie\ File Web browser cookie text +0 string #\ Netscape\ HTTP\ Cookie\ File Netscape cookie text +0 string #\ KDE\ Cookie\ File Konqueror cookie text diff --git a/contrib/file/Magdir/vorbis b/contrib/file/Magdir/vorbis index 5e40842..8977845 100644 --- a/contrib/file/Magdir/vorbis +++ b/contrib/file/Magdir/vorbis @@ -32,14 +32,17 @@ >>>>>44 lelong !-1 # Vorbis RC2 has a bug which puts -1000 in the min/max bitrate fields # instead of -1. +# Vorbis 1.0 uses 0 instead of -1. >>>>>>44 lelong !-1000 ->>>>>>>44 lelong x >%lu +>>>>>>>44 lelong !0 +>>>>>>>>44 lelong x >%lu >>>>>48 lelong !-1 >>>>>>48 lelong x ~%lu >>>>>52 lelong !-1 ->>>>>>52 lelong !-1000 ->>>>>>>52 lelong x <%lu ->>>>>48 string <\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff kbps +>>>>>>52 lelong !0 +>>>>>>>52 lelong !-1000 +>>>>>>>>52 lelong x <%lu +>>>>>48 string <\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff bps # -- Second vorbis header packet - the comments # A kludge to read the vendor string. It's a counted string, not a # zero-terminated one, so file(1) can't read it in a generic way. @@ -67,10 +70,10 @@ >>>>>>(84.b+120) string 20011014 (RC2 - Garf tuned v2) >>>>>>(84.b+120) string 20011217 (pre-RC3 CVS) >>>>>>(84.b+120) string 20011231 (RC3) -# The string has not changed from beta1 to 2 - they are indistinguishable. -# Then come the comments, again length-counted (and number-counted). -# Some looping constructs and registers would allow reading them but now -# it's impossible. However we can print the number of comments present -# (skipping by the vendor string length): -##>>>>(109.l.113) lelong 0 \b, no comments -##>>>>(109.l+113) lelong >0 \b, %lu comments +# Some pre-1.0 CVS snapshots still had "Xiphphorus"... +>>>>>>(84.b+120) string >20011231 (pre-1.0 CVS) +# For the 1.0 release, Xiphophorus is replaced by Xiph.Org +>>>>(84.b+96) string/c Xiph.Org\ libVorbis\ I \b, created by: Xiph.Org libVorbis I +>>>>>(84.b+117) string >00000000 %.8s +>>>>>>(84.b+117) string <20020717 (pre-1.0 CVS) +>>>>>>(84.b+117) string 20020717 (1.0) diff --git a/contrib/file/Makefile.am b/contrib/file/Makefile.am index c26f6f9..46fd2ae 100644 --- a/contrib/file/Makefile.am +++ b/contrib/file/Makefile.am @@ -116,7 +116,6 @@ Magdir/ibm370 \ Magdir/ibm6000 \ Magdir/iff \ Magdir/images \ -Magdir/impulse \ Magdir/intel \ Magdir/interleaf \ Magdir/island \ diff --git a/contrib/file/Makefile.in b/contrib/file/Makefile.in index f61dafc..8dd783a 100644 --- a/contrib/file/Makefile.in +++ b/contrib/file/Makefile.in @@ -86,7 +86,7 @@ EXTRA_DIST = LEGAL.NOTICE MAINT PORTING Makefile.std magic2mime Localstuff Head CLEANFILES = $(man_MANS) magic magic.mgc magic.mime.mgc -magic_FRAGMENTS = Magdir/acorn Magdir/adi Magdir/adventure Magdir/allegro Magdir/alliant Magdir/alpha Magdir/amanda Magdir/amigaos Magdir/animation Magdir/apl Magdir/apple Magdir/applix Magdir/archive Magdir/asterix Magdir/att3b Magdir/audio Magdir/blender Magdir/blit Magdir/bsdi Magdir/c-lang Magdir/cddb Magdir/chi Magdir/cisco Magdir/citrus Magdir/claris Magdir/clipper Magdir/commands Magdir/compress Magdir/console Magdir/convex Magdir/ctags Magdir/cvs Magdir/database Magdir/diamond Magdir/diff Magdir/digital Magdir/dolby Magdir/dump Magdir/dyadic Magdir/editors Magdir/elf Magdir/encore Magdir/epoc Magdir/filesystems Magdir/flash Magdir/fonts Magdir/frame Magdir/freebsd Magdir/fsav Magdir/gimp Magdir/gnu Magdir/grace Magdir/gringotts Magdir/hitachi-sh Magdir/hp Magdir/ibm370 Magdir/ibm6000 Magdir/iff Magdir/images Magdir/impulse Magdir/intel Magdir/interleaf Magdir/island Magdir/ispell Magdir/java Magdir/jpeg Magdir/karma Magdir/lecter Magdir/lex Magdir/lif Magdir/linux Magdir/lisp Magdir/mach Magdir/macintosh Magdir/magic Magdir/mail.news Magdir/maple Magdir/mathematica Magdir/mcrypt Magdir/mime Magdir/mips Magdir/mirage Magdir/mkid Magdir/mmdf Magdir/mlssa Magdir/modem Magdir/motorola Magdir/msdos Magdir/msvc Magdir/natinst Magdir/ncr Magdir/netbsd Magdir/netscape Magdir/news Magdir/nitpicker Magdir/octave Magdir/olf Magdir/os2 Magdir/os9 Magdir/osf1 Magdir/palm Magdir/parix Magdir/pbm Magdir/pdf Magdir/pdp Magdir/perl Magdir/pgp Magdir/pkgadd Magdir/plus5 Magdir/printer Magdir/project Magdir/psdbms Magdir/pulsar Magdir/pyramid Magdir/python Magdir/riff Magdir/rpm Magdir/rtf Magdir/sc Magdir/sccs Magdir/sendmail Magdir/sequent Magdir/sgml Magdir/sharc Magdir/sketch Magdir/smalltalk Magdir/sniffer Magdir/softquad Magdir/spectrum Magdir/sun Magdir/sysex Magdir/teapot Magdir/terminfo Magdir/tex Magdir/tgif Magdir/ti-8x Magdir/timezone Magdir/troff Magdir/tuxedo Magdir/typeset Magdir/unknown Magdir/uuencode Magdir/varied.out Magdir/vax Magdir/vicar Magdir/visx Magdir/vms Magdir/vmware Magdir/vorbis Magdir/vxl Magdir/wordperfect Magdir/xdelta Magdir/xenix Magdir/zilog Magdir/zyxel +magic_FRAGMENTS = Magdir/acorn Magdir/adi Magdir/adventure Magdir/allegro Magdir/alliant Magdir/alpha Magdir/amanda Magdir/amigaos Magdir/animation Magdir/apl Magdir/apple Magdir/applix Magdir/archive Magdir/asterix Magdir/att3b Magdir/audio Magdir/blender Magdir/blit Magdir/bsdi Magdir/c-lang Magdir/cddb Magdir/chi Magdir/cisco Magdir/citrus Magdir/claris Magdir/clipper Magdir/commands Magdir/compress Magdir/console Magdir/convex Magdir/ctags Magdir/cvs Magdir/database Magdir/diamond Magdir/diff Magdir/digital Magdir/dolby Magdir/dump Magdir/dyadic Magdir/editors Magdir/elf Magdir/encore Magdir/epoc Magdir/filesystems Magdir/flash Magdir/fonts Magdir/frame Magdir/freebsd Magdir/fsav Magdir/gimp Magdir/gnu Magdir/grace Magdir/gringotts Magdir/hitachi-sh Magdir/hp Magdir/ibm370 Magdir/ibm6000 Magdir/iff Magdir/images Magdir/intel Magdir/interleaf Magdir/island Magdir/ispell Magdir/java Magdir/jpeg Magdir/karma Magdir/lecter Magdir/lex Magdir/lif Magdir/linux Magdir/lisp Magdir/mach Magdir/macintosh Magdir/magic Magdir/mail.news Magdir/maple Magdir/mathematica Magdir/mcrypt Magdir/mime Magdir/mips Magdir/mirage Magdir/mkid Magdir/mmdf Magdir/mlssa Magdir/modem Magdir/motorola Magdir/msdos Magdir/msvc Magdir/natinst Magdir/ncr Magdir/netbsd Magdir/netscape Magdir/news Magdir/nitpicker Magdir/octave Magdir/olf Magdir/os2 Magdir/os9 Magdir/osf1 Magdir/palm Magdir/parix Magdir/pbm Magdir/pdf Magdir/pdp Magdir/perl Magdir/pgp Magdir/pkgadd Magdir/plus5 Magdir/printer Magdir/project Magdir/psdbms Magdir/pulsar Magdir/pyramid Magdir/python Magdir/riff Magdir/rpm Magdir/rtf Magdir/sc Magdir/sccs Magdir/sendmail Magdir/sequent Magdir/sgml Magdir/sharc Magdir/sketch Magdir/smalltalk Magdir/sniffer Magdir/softquad Magdir/spectrum Magdir/sun Magdir/sysex Magdir/teapot Magdir/terminfo Magdir/tex Magdir/tgif Magdir/ti-8x Magdir/timezone Magdir/troff Magdir/tuxedo Magdir/typeset Magdir/unknown Magdir/uuencode Magdir/varied.out Magdir/vax Magdir/vicar Magdir/visx Magdir/vms Magdir/vmware Magdir/vorbis Magdir/vxl Magdir/wordperfect Magdir/xdelta Magdir/xenix Magdir/zilog Magdir/zyxel ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs diff --git a/contrib/file/Makefile.std b/contrib/file/Makefile.std index b930f04..9691211 100644 --- a/contrib/file/Makefile.std +++ b/contrib/file/Makefile.std @@ -1,6 +1,6 @@ # Makefile for file(1) cmd. # Copyright (c) Ian F. Darwin 86/09/01 - see LEGAL.NOTICE. -# @(#)$Id: Makefile.std,v 1.15 2002/07/03 18:57:52 christos Exp $ +# @(#)$Id: Makefile.std,v 1.16 2003/02/08 18:35:36 christos Exp $ # # This software is not subject to any license of the American Telephone # and Telegraph Company or of the Regents of the University of California. @@ -22,7 +22,7 @@ # # 4. This notice may not be removed or altered. # -VERSION = 3.39 +VERSION = 3.40 SHELL = /bin/sh #MAGIC = /etc/magic MAGIC = /usr/local/etc/magic diff --git a/contrib/file/README b/contrib/file/README index 1a0ff8d..0fd8c47 100644 --- a/contrib/file/README +++ b/contrib/file/README @@ -1,5 +1,5 @@ ** README for file(1) Command ** -@(#) $Id: README,v 1.26 2002/05/16 18:45:56 christos Exp $ +@(#) $Id: README,v 1.28 2003/02/08 18:35:36 christos Exp $ This is Release 3.x of Ian Darwin's (copyright but distributable) file(1) command. This version is the standard "file" command for Linux, @@ -91,7 +91,7 @@ DOS and Mac. From: Kees Zeelenberg -An MS-Windows (Win32) port of File-3.36 is available from +An MS-Windows (Win32) port of File-3.40 is available from http://gnuwin32.sourceforge.net/ File is an implementation of the Unix File(1) command. It knows the 'magic number' of several thousands of file types. diff --git a/contrib/file/ascmagic.c b/contrib/file/ascmagic.c index cbbcbe8..8217f19 100644 --- a/contrib/file/ascmagic.c +++ b/contrib/file/ascmagic.c @@ -45,7 +45,7 @@ #include "names.h" #ifndef lint -FILE_RCSID("@(#)$Id: ascmagic.c,v 1.32 2002/07/03 18:26:37 christos Exp $") +FILE_RCSID("@(#)$Id: ascmagic.c,v 1.33 2003/02/08 18:33:53 christos Exp $") #endif /* lint */ typedef unsigned long unichar; @@ -67,7 +67,7 @@ int ascmagic(unsigned char *buf, int nbytes) { int i; - char nbuf[HOWMANY+1]; /* one extra for terminating '\0' */ + unsigned char nbuf[HOWMANY+1]; /* one extra for terminating '\0' */ unichar ubuf[HOWMANY+1]; /* one extra for terminating '\0' */ int ulen; struct names *p; @@ -211,7 +211,8 @@ ascmagic(unsigned char *buf, int nbytes) * compare the word thus isolated against the token list */ for (p = names; p < names + NNAMES; p++) { - if (ascmatch(p->name, ubuf + i, end - i)) { + if (ascmatch((unsigned char *)p->name, ubuf + i, + end - i)) { subtype = types[p->type].human; subtype_mime = types[p->type].mime; goto subtype_identified; @@ -565,7 +566,7 @@ looks_unicode(const unsigned char *buf, int nbytes, unichar *ubuf, int *ulen) return 0; } - return 1; + return 1 + bigend; } #undef F diff --git a/contrib/file/config.h.in b/contrib/file/config.h.in index aa05824..36e61ed 100644 --- a/contrib/file/config.h.in +++ b/contrib/file/config.h.in @@ -67,6 +67,9 @@ /* The number of bytes in a uint64_t. */ #define SIZEOF_UINT64_T 0 +/* Define if you have the getopt_long function. */ +#undef HAVE_GETOPT_LONG + /* Define if you have the mkstemp function. */ #undef HAVE_MKSTEMP @@ -85,6 +88,9 @@ /* Define if you have the <getopt.h> header file. */ #undef HAVE_GETOPT_H +/* Define if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + /* Define if you have the <locale.h> header file. */ #undef HAVE_LOCALE_H diff --git a/contrib/file/configure b/contrib/file/configure index a258ab3..e4c04f1 100755 --- a/contrib/file/configure +++ b/contrib/file/configure @@ -699,7 +699,7 @@ fi PACKAGE=file -VERSION=3.39 +VERSION=3.40 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } @@ -2740,7 +2740,7 @@ EOF -for ac_func in mmap strerror strtoul mkstemp +for ac_func in mmap strerror strtoul mkstemp getopt_long do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:2747: checking for $ac_func" >&5 diff --git a/contrib/file/configure.in b/contrib/file/configure.in index 2cd216e..ac460e9 100644 --- a/contrib/file/configure.in +++ b/contrib/file/configure.in @@ -60,10 +60,10 @@ AC_HEADER_SYS_WAIT AC_HEADER_STDINT AC_CHECK_HEADERS(fcntl.h locale.h) AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h) +AC_CHECK_HEADERS(stdint.h inttypes.h) AC_CHECK_HEADERS(unistd.h) AC_CHECK_HEADERS(getopt.h) AC_CHECK_HEADERS(locale.h) -AC_CHECK_HEADERS(stdint.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST @@ -91,7 +91,7 @@ AC_CHECK_SIZEOF_STDC_HEADERS(uint32_t, 0) AC_CHECK_SIZEOF_STDC_HEADERS(uint64_t, 0) dnl Checks for functions -AC_CHECK_FUNCS(mmap strerror strtoul mkstemp) +AC_CHECK_FUNCS(mmap strerror strtoul mkstemp getopt_long) dnl Checks for libraries AC_CHECK_LIB(z,gzopen) diff --git a/contrib/file/file.c b/contrib/file/file.c index 4779938..5dedd9b 100644 --- a/contrib/file/file.c +++ b/contrib/file/file.c @@ -58,7 +58,7 @@ #include "patchlevel.h" #ifndef lint -FILE_RCSID("@(#)$Id: file.c,v 1.66 2002/07/03 19:00:41 christos Exp $") +FILE_RCSID("@(#)$Id: file.c,v 1.68 2003/02/08 18:33:53 christos Exp $") #endif /* lint */ @@ -88,7 +88,8 @@ int /* Global command-line options */ zflag = 0, /* follow (uncompress) compressed files */ sflag = 0, /* read block special files */ iflag = 0, - nobuffer = 0, /* Do not buffer stdout */ + nopad = 0, /* Don't pad output */ + nobuffer = 0, /* Do not buffer stdout */ kflag = 0; /* Keep going after the first match */ int /* Misc globals */ @@ -99,13 +100,15 @@ struct magic *magic; /* array of magic entries */ const char *magicfile = 0; /* where the magic is */ const char *default_magicfile = MAGIC; +char separator = ':'; /* Default field separator */ + char *progname; /* used throughout */ int lineno; /* line number in the magic file */ static void unwrap(char *fn); static void usage(void); -#ifdef HAVE_GETOPT_H +#ifdef HAVE_GETOPT_LONG static void help(void); #endif #if 0 @@ -125,8 +128,8 @@ main(int argc, char **argv) int action = 0, didsomefiles = 0, errflg = 0, ret = 0, app = 0; char *mime, *home, *usermagic; struct stat sb; -#define OPTSTRING "bcdf:ikm:nsvzCL" -#ifdef HAVE_GETOPT_H +#define OPTSTRING "bcdf:F:ikm:nNsvzCL" +#ifdef HAVE_GETOPT_LONG int longindex; static struct option long_options[] = { @@ -136,6 +139,7 @@ main(int argc, char **argv) {"checking-printout", 0, 0, 'c'}, {"debug", 0, 0, 'd'}, {"files-from", 1, 0, 'f'}, + {"separator", 1, 0, 'F'}, {"mime", 0, 0, 'i'}, {"keep-going", 0, 0, 'k'}, #ifdef S_IFLNK @@ -144,6 +148,7 @@ main(int argc, char **argv) {"magic-file", 1, 0, 'm'}, {"uncompress", 0, 0, 'z'}, {"no-buffer", 0, 0, 'n'}, + {"no-pad", 0, 0, 'N'}, {"special-files", 0, 0, 's'}, {"compile", 0, 0, 'C'}, {0, 0, 0, 0}, @@ -179,14 +184,14 @@ main(int argc, char **argv) } } -#ifndef HAVE_GETOPT_H +#ifndef HAVE_GETOPT_LONG while ((c = getopt(argc, argv, OPTSTRING)) != -1) #else while ((c = getopt_long(argc, argv, OPTSTRING, long_options, &longindex)) != -1) #endif switch (c) { -#ifdef HAVE_GETOPT_H +#ifdef HAVE_GETOPT_LONG case 0 : if (longindex == 1) help(); @@ -214,6 +219,9 @@ main(int argc, char **argv) unwrap(optarg); ++didsomefiles; break; + case 'F': + separator = *optarg; + break; case 'i': iflag++; if ((mime = malloc(strlen(magicfile) + 6)) != NULL) { @@ -231,6 +239,9 @@ main(int argc, char **argv) case 'n': ++nobuffer; break; + case 'N': + ++nopad; + break; case 's': sflag++; break; @@ -404,8 +415,8 @@ process(const char *inname, int wid) } if (wid > 0 && !bflag) - (void) printf("%s:%*s ", inname, - (int) (wid - strlen(inname)), ""); + (void) printf("%s%c%*s", inname, separator, + (int) (nopad ? 0 : 1 + (wid - strlen(inname))), ""); if (inname != stdname) { /* @@ -523,13 +534,13 @@ usage(void) { (void)fprintf(stderr, USAGE, progname); (void)fprintf(stderr, "Usage: %s -C [-m magic]\n", progname); -#ifdef HAVE_GETOPT_H +#ifdef HAVE_GETOPT_LONG (void)fputs("Try `file --help' for more information.\n", stderr); #endif exit(1); } -#ifdef HAVE_GETOPT_H +#ifdef HAVE_GETOPT_LONG static void help(void) { diff --git a/contrib/file/file.h b/contrib/file/file.h index 76bf806..874beb9 100644 --- a/contrib/file/file.h +++ b/contrib/file/file.h @@ -1,6 +1,6 @@ /* * file.h - definitions for file(1) program - * @(#)$Id: file.h,v 1.43 2002/07/03 18:57:52 christos Exp $ + * @(#)$Id: file.h,v 1.45 2003/02/08 18:33:53 christos Exp $ * * Copyright (c) Ian F. Darwin, 1987. * Written by Ian F. Darwin. @@ -43,6 +43,8 @@ #include <stdio.h> #ifdef HAVE_STDINT_H #include <stdint.h> +#elif defined(HAVE_INTTYPES_H) +#include <inttypes.h> #endif /* Do this here and now, because struct stat gets re-defined on solaris */ #include <sys/stat.h> @@ -60,6 +62,10 @@ #define CHECK 1 #define COMPILE 2 +#ifndef __GNUC__ +#define __attribute__(a) +#endif + struct magic { uint16_t cont_level; /* level of ">" */ uint8_t nospflag; /* supress space character */ diff --git a/contrib/file/file.man b/contrib/file/file.man index de3e0a6..f47509f 100644 --- a/contrib/file/file.man +++ b/contrib/file/file.man @@ -1,18 +1,21 @@ .TH FILE __CSECTION__ "Copyright but distributable" -.\" $Id: file.man,v 1.42 2002/07/03 18:26:37 christos Exp $ +.\" $Id: file.man,v 1.43 2003/02/08 18:33:53 christos Exp $ .SH NAME file \- determine file type .SH SYNOPSIS .B file [ -.B \-bciknsvzL +.B \-bciknNsvzL ] [ .B \-f .I namefile ] [ +.B \-F +separator ] +[ .B \-m .I magicfiles ] @@ -172,6 +175,9 @@ Either or at least one filename argument must be present; to test the standard input, use ``\-'' as a filename argument. .TP 8 +.BI \-F " separator" +Use the specified separator character instead of ``:''. +.TP 8 .B \-i Causes the file command to output mime type strings rather than the more traditional human readable ones. Thus it may say @@ -195,6 +201,9 @@ Force stdout to be flushed after checking each file. This is only useful if checking a list of files. It is intended to be used by programs that want filetype output from a pipe. .TP 8 +.B \-N +Don't pad output to align filenames nicely. +.TP 8 .B \-v Print the version of the program and exit. .TP 8 @@ -228,7 +237,7 @@ to disregard the file size as reported by since on some systems it reports a zero size for raw disk partitions. .SH FILES .I __MAGIC__.mgc -\- defaults compiled list of magic numbers +\- default compiled list of magic numbers .PP .I __MAGIC__ \- default list of magic numbers diff --git a/contrib/file/magic.man b/contrib/file/magic.man index 81e5fb38..b07f584 100644 --- a/contrib/file/magic.man +++ b/contrib/file/magic.man @@ -170,7 +170,7 @@ is used as an offset in the file. A byte, short or long is read at that offset depending on the .B [bslBSL] type specifier. The capitalized types interpret the number as a big endian -value, whereas the small letter versions interpet the number as a little +value, whereas the small letter versions interpret the number as a little endian value. To that number the value of .I y is added and the result is used as an offset in the file. The default type @@ -219,4 +219,4 @@ indirect offsets. .\" the changes I posted to the S5R2 version. .\" .\" Modified for Ian Darwin's version of the file command. -.\" @(#)$Id: magic.man,v 1.19 2002/07/03 18:26:38 christos Exp $ +.\" @(#)$Id: magic.man,v 1.20 2003/02/08 18:33:53 christos Exp $ diff --git a/contrib/file/patchlevel.h b/contrib/file/patchlevel.h index de8d598..aba7461 100644 --- a/contrib/file/patchlevel.h +++ b/contrib/file/patchlevel.h @@ -1,11 +1,18 @@ #define FILE_VERSION_MAJOR 3 -#define patchlevel 39 +#define patchlevel 40 /* * Patchlevel file for Ian Darwin's MAGIC command. - * $Id: patchlevel.h,v 1.39 2002/07/03 18:57:52 christos Exp $ + * $Id: patchlevel.h,v 1.40 2003/02/08 18:33:53 christos Exp $ * * $Log: patchlevel.h,v $ + * Revision 1.40 2003/02/08 18:33:53 christos + * - detect inttypes.h too (Dave Love <d.love@dl.ac.uk>) + * - eliminate unsigned char warnings (Petter Reinholdtsen <pere@hungry.com>) + * - better elf PT_NOTE handling (Nalin Dahyabhai <nalin@redhat.com>) + * - add options to format the output differently + * - much more magic. + * * Revision 1.39 2002/07/03 18:57:52 christos * - ansify/c99ize * - more magic diff --git a/contrib/file/print.c b/contrib/file/print.c index 38ca9d3..0b1a0e4 100644 --- a/contrib/file/print.c +++ b/contrib/file/print.c @@ -27,11 +27,7 @@ #include "file.h" #include <string.h> -#ifdef __STDC__ -# include <stdarg.h> -#else -# include <varargs.h> -#endif +#include <stdarg.h> #include <stdlib.h> #ifdef HAVE_UNISTD_H #include <unistd.h> @@ -39,7 +35,7 @@ #include <time.h> #ifndef lint -FILE_RCSID("@(#)$Id: print.c,v 1.38 2002/07/03 18:37:44 christos Exp $") +FILE_RCSID("@(#)$Id: print.c,v 1.39 2002/07/09 15:46:23 christos Exp $") #endif /* lint */ #define SZOF(a) (sizeof(a) / sizeof(a[0])) diff --git a/contrib/file/readelf.c b/contrib/file/readelf.c index 0ae8ef3..6e19167 100644 --- a/contrib/file/readelf.c +++ b/contrib/file/readelf.c @@ -11,7 +11,7 @@ #include "readelf.h" #ifndef lint -FILE_RCSID("@(#)$Id: readelf.c,v 1.22 2002/07/03 18:26:38 christos Exp $") +FILE_RCSID("@(#)$Id: readelf.c,v 1.23 2003/02/08 18:33:53 christos Exp $") #endif #ifdef ELFCORE @@ -104,6 +104,9 @@ getu64(int swap, uint64_t value) #define ph_offset (class == ELFCLASS32 \ ? getu32(swap, ph32.p_offset) \ : getu64(swap, ph64.p_offset)) +#define ph_align (class == ELFCLASS32 \ + ? (ph32.p_align ? getu32(swap, ph32.p_align) : 4) \ + : (ph64.p_align ? getu64(swap, ph64.p_align) : 4)) #define nh_size (class == ELFCLASS32 \ ? sizeof *nh32 \ : sizeof *nh64) @@ -157,6 +160,7 @@ dophn_exec(int class, int swap, int fd, off_t off, int num, size_t size) char nbuf[BUFSIZ]; int bufsize; size_t offset, nameoffset; + off_t savedoffset; if (lseek(fd, off, SEEK_SET) == -1) error("lseek failed (%s).\n", strerror(errno)); @@ -164,6 +168,8 @@ dophn_exec(int class, int swap, int fd, off_t off, int num, size_t size) for ( ; num; num--) { if (read(fd, ph_addr, size) == -1) error("read failed (%s).\n", strerror(errno)); + if ((savedoffset = lseek(fd, 0, SEEK_CUR)) == -1) + error("lseek failed (%s).\n", strerror(errno)); switch (ph_type) { case PT_DYNAMIC: @@ -179,7 +185,7 @@ dophn_exec(int class, int swap, int fd, off_t off, int num, size_t size) */ if (lseek(fd, (off_t) ph_offset, SEEK_SET) == -1) error("lseek failed (%s).\n", strerror(errno)); - bufsize = read(fd, nbuf, BUFSIZ); + bufsize = read(fd, nbuf, sizeof(nbuf)); if (bufsize == -1) error(": " "read failed (%s).\n", strerror(errno)); @@ -202,7 +208,14 @@ dophn_exec(int class, int swap, int fd, off_t off, int num, size_t size) nameoffset = offset; offset += nh_namesz; - offset = ((offset + 3)/4)*4; + offset = ((offset+ph_align-1)/ph_align)*ph_align; + + if ((nh_namesz == 0) && (nh_descsz == 0)) { + /* + * We're out of note headers. + */ + break; + } if (offset + nh_descsz >= bufsize) break; @@ -277,6 +290,8 @@ dophn_exec(int class, int swap, int fd, off_t off, int num, size_t size) /* Content of note is always 0 */ } } + if ((lseek(fd, savedoffset + offset, SEEK_SET)) == -1) + error("lseek failed (%s).\n", strerror(errno)); break; } } diff --git a/contrib/file/softmagic.c b/contrib/file/softmagic.c index 891910c..8ef5fbf 100644 --- a/contrib/file/softmagic.c +++ b/contrib/file/softmagic.c @@ -34,7 +34,7 @@ #ifndef lint -FILE_RCSID("@(#)$Id: softmagic.c,v 1.51 2002/07/03 18:26:38 christos Exp $") +FILE_RCSID("@(#)$Id: softmagic.c,v 1.52 2003/02/08 18:33:53 christos Exp $") #endif /* lint */ static int match(struct magic *, uint32_t, unsigned char *, int); @@ -564,9 +564,10 @@ mget(union VALUETYPE *p, unsigned char *s, struct magic *m, int nbytes) * offset is interpreted as last line to search, * (starting at 1), not as bytes-from start-of-file */ - char *last = NULL; - p->buf = s; - for (; offset && (s = strchr(s, '\n')) != NULL; offset--, s++) + unsigned char *last = NULL; + p->buf = (char *)s; + for (; offset && (s = (unsigned char *)strchr(s, '\n')) != NULL; + offset--, s++) last = s; if (last != NULL) *last = '\0'; |