ChangeLog   [plain text]

2008-12-12 15:50  Christos Zoulas <>

	* fix initial offset calculation for non 4K sector files

	* add loop limits to avoid DoS attacks by constructing
	  looping sector references.

2008-12-03 13:05  Christos Zoulas <>

	* fix memory botches on cdf file parsing.

	* exit with non-zero value for any error, not just for the last
	  file processed.

2008-11-09 20:42  Charles Longeau <>

	* Replace all str{cpy,cat} functions with strl{cpy,cat}
	* Ensure that strl{cpy,cat} are included in libmagic,
	  as needed.

2008-11-06 18:18  Christos Zoulas <>

	* Handle ID3 format files.

2008-11-06 23:00  Reuben Thomas <>

	* Fix --mime, --mime-type and --mime-encoding under new scheme.

	* Rename "ascii" to "text" and add "encoding" test.

	* Return a precise ("utf-16le" or "utf-16be") MIME charset for

	* Fix error in comment caused by automatic indentation adding

2008-11-06 10:35  Christos Zoulas <>

	* use memchr instead of strchr because the string
	  might not be NUL terminated (Scott MacVicar)

2008-11-03 07:31  Reuben Thomas <>

	* Fix a printf with a non-literal format string.

	* Fix formatting and punctuation of help for "--apple".

2008-10-30 11:00  Reuben Thomas <>

	* Correct words counts in comments of struct magic.

	* Fix handle_annotation to allow both Apple and MIME types to be
	  printed, and to return correct code if MIME type is
	  printed (1, not 0) or if there's an error (-1 not 1).

	* Fix output of charset for MIME type (precede with semi-colon;
	  fixes Debian bug #501460).

	* Fix potential attacks via conversion specifications in magic

	* Add a FIXME for Debian bug #488562 (magic files should be
	  read in a defined order, by sorting the names).

2008-10-18 16:45  Christos Zoulas <>

	* Added APPLE file creator/type

2008-10-12 10:20  Christos Zoulas <>

	* Added CDF parsing

2008-10-09 16:40  Christos Zoulas <>

	* filesystem and msdos patches (Joerg Jenderek)

2008-10-09 13:20  Christos Zoulas <>

	* correct --exclude documentation issues: remove troff and fortran
	  and rename "token" to "tokens". (Randy McMurchy)

2008-10-01 10:30  Christos Zoulas <>

	* Read ~/.magic in addition to the default magic file not instead
	  of, as documented in the man page.

2008-09-10 21:30  Reuben Thomas  <>

	* Comment out graphviz patterns, as they match too many files.

2008-08-30 12:54  Christos Zoulas <>

	* Don't eat trailing \n in magic enties.

	* Cast defines to allow compilation using a c++ compiler.

2008-08-25 23:56  Reuben Thomas  <>

	* Add text/x-lua MIME type for Lua scripts.

	* Escape { in regex in graphviz patterns.

2008-07-26 00:59  Reuben Thomas  <>

	* Add MIME types for special files.

	* Use access to give more accurate information for files that
	  can't be opened.

	* Add a TODO list.

2008-07-02 11:15  Christos Zoulas  <>

	* add !:strength op to adjust magic strength (experimental)

2008-06-16 21:41  Reuben Thomas  <>

	* Fix automake error in

	* Add MIME type for Psion Sketch files.

2008-06-05 08:59  Christos Zoulas  <>

	* Don't print warnings about bad namesize in stripped
	  binaries with PT_NOTE is still there, and the actual
	  note is gone (Jakub Jelinek)

2008-05-28 15:12  Robert Byrnes  <>

	* magic/Magdir/elf:
	  Note invalid byte order for little-endian SPARC32PLUS.
	  Add SPARC V9 vendor extensions and memory model.

	* src/elfclass.h:
	  Pass target machine to doshn (for Solaris hardware capabilities).

	* src/readelf.c (doshn):
	  Add support for Solaris hardware/software capabilities.

	* src/readelf.h:

	* src/vasprintf.c (dispatch):
	  Add support for ll modifier.

2008-05-16 10:25  Christos Zoulas  <>

	* Fix compiler warnings.

	* remove stray printf, and fix a vprintf bug. (Martin Dorey)

2008-05-06 00:13  Robert Byrnes  <>

	* src/
	  Ensure that getopt_long and [v]asprintf are included in libmagic,
	  as needed.

	  Remove unnecessary EXTRA_DIST.

	* src/
	  Rerun automake.

	* src/vasprintf.c (dispatch):
	  Fix variable precision bug: be sure to step past '*'.

	* src/vasprintf.c (core):
	  Remove unreachable code.

	* src/apprentice.c (set_test_type):
	  Add cast to avoid compiler warning.

2008-04-22 23:45  Christos Zoulas  <>

	* Add magic submission guidelines (Abel Cheung)

	* split msdos and windows magic (Abel Cheung)

2008-04-04 11:00  Christos Zoulas  <>

	* >= <= is not supported, so fix the magic and warn about it.
	  reported by: Thien-Thi Nguyen <>

2008-03-27 16:16  Robert Byrnes  <>

	* src/readelf.c (donote):
	  ELF core file command name/line bug fixes and enhancements:

	  Try larger offsets first to avoid false matches
	  from earlier data that happen to look like strings;
	  this primarily affected SunOS 5.x 32-bit Intel core files.

	  Add support for command line (instead of just short name)
	  for SunOS 5.x.

	  Add information about NT_PSINFO for SunOS 5.x.

	  Only trim whitespace from end of command line.

2007-02-11 01:36 Reuben Thomas <>

	* Change strength of ! from MULT to 0, as it matches almost
		  anything (Reuben Thomas)

	* Debian fixes (Reuben Thomas)

2007-02-11 00:17 Reuben Thomas <>

	* Clarify UTF-8 BOM message (Reuben Thomas)

	* Add HTML comment to token list in names.h

2007-02-04 15:50 Christos Zoulas <>

	* Debian fixes (Reuben Thomas)

2007-02-04 11:31 Christos Zoulas <>

	* !:mime annotations in magic files (Reuben Thomas)

2007-01-29 15:35 Christos Zoulas <>

	* zero out utime/utimes structs (Gavin Atkinson)

2007-01-26 13:45 Christos Zoulas <>

	* reduce writable data from Diego "Flameeyes" Petten

2007-12-28 15:06 Christos Zoulas <>

	* strtof detection

	* remove bogus regex magic that could cause a DoS

	* better mismatch version message

2007-12-27 11:35 Christos Zoulas <>

	* bring back some fixes from OpenBSD

	* treat ELF dynamic objects as executables

	* fix gcc warnings

2007-12-01 19:55 Christos Zoulas <>

	* make sure we have zlib.h and libz to compile the builtin
	  decompress code

2007-10-28 20:48 Christos Zoulas <>

 	* float and double magic support (Behan Webster)

2007-10-28 20:48 Christos Zoulas <>

	* Convert fortran to a soft test (Reuben Thomas)

2007-10-23  5:25 Christos Zoulas <>

	* Add --with-filename, and --no-filename (Reuben Thomas)

2007-10-23  3:59 Christos Zoulas <>

	* Rest of the mime split (Reuben Thomas)

	* Make usage message generated from the flags so that
	  they stay consistent (Reuben Thomas)

2007-10-20  3:06 Christos Zoulas <>

	* typo in comment, missing ifdef QUICK, remove unneeded code
		(Charles Longeau)

2007-10-17  3:33 Christos Zoulas <>

	* Fix problem printing -\012 in some entries

	* Separate magic type and encoding flags (Reuben Thomas)

2007-10-09  3:55 Christos Zoulas <>

	* configure fix for int64 and strndup (Reuben Thomas)

2007-09-26  4:45 Christos Zoulas <>

	* Add magic_descriptor() function.

	* Fix regression in elf reading code where the core name was
	  not being printed.

	* Don't convert NUL's to spaces in {l,b}estring16 (Daniel Dawson)

2007-08-19  6:30 Christos Zoulas <>

	* Make mime format consistent so that it can
	  be easily parsed:
	      mimetype [charset=character-set] [encoding=encoding-mime-type]

	  Remove spurious extra text from some MIME type printouts
	  (mostly in is_tar).

	  Fix one case where -i produced nothing at all (for a 1-byte file,
	  which is now classed as application/octet-stream).

	  Remove 7/8bit classifications, since they were arbitrary
	  and not based on the file data.

	  This work was done by Reuben Thomas

2007-05-24 10:00 Christos Zoulas <>

	* Fix another integer overflow (Colin Percival)

2007-03-26 13:58 Christos Zoulas <>

	* make sure that all of struct magic_set is initialized appropriately

2007-03-25 17:44 Christos Zoulas <>

	* reset left bytes in the buffer (Dmitry V. Levin)

	* compilation failed with COMPILE_ONLY and ENABLE_CONDITIONALS
	  (Peter Avalos)

2007-03-15 10:51 Christos Zoulas <>

	* fix fortran and nroff reversed tests (Dmitry V. Levin)

	* fix exclude option (Dmitry V. Levin)

2007-02-08 17:30 Christos Zoulas <>

	* fix integer underflow in file_printf which can lead to
	  to exploitable heap overflow (Jean-Sebastien Guay-Lero)

2007-02-05 11:35 Christos Zoulas <>

	* make socket/pipe reading more robust

2007-01-25 16:01 Christos Zoulas <>

	* Centralize all the tests in file_buffer.

	* Add exclude flag.

2007-01-18 05:29 Anon Ymous <>

	* Move the "type" detection code from parse() into its own table
	  driven routine.  This avoids maintaining multiple lists in

	* Add an optional conditional field (ust before the type field).
	  This code is wrapped in "#ifdef ENABLE_CONDITIONALS" as it is
	  likely to go away.

2007-01-16 23:24 Anon Ymous <>

	* Fix an initialization bug in check_mem().

2007-01-16 14:58 Anon Ymous <>

	* Add a "default" type to print a message if nothing previously
	  matched at that level or since the last default at that
	  level.  This is useful for setting up switch-like statements.
	  It can also be used to do if/else constructions without a
	  redundant second test.

	* Fix the "x" special case test so that one can test for that
	  string with "=x".

	* Allow "search" to search the entire buffer if the "/N"
	  search count is missing.

	* Make "regex" work!  It now starts its search at the
	  specified offset and takes an (optional) "/N" line count to
	  specify the search range; otherwise it searches to the end
	  of the file.  The match is now grabbed correctly for format
	  strings and the offset set to the end of the match.

	* Add a "/s" flag to "regex" and "search" to set the offset to
	  the start of the match.  By default the offset is set to the
	  end of the match, as it is with other tests.  This is mostly
	  useful for "regex".

	* Make "search", "string" and "pstring" use the same
	  file_strncmp() routine so that they support the same flags;
	  "bestring16" and "lestring16" call the same routine, but
	  with flags = 0.  Also add a "/C" flag (in analogy to "/c")
	  to ignore the case on uppercase (lowercase) characters in
	  the test string.

	* Strict adherence to C style string escapes.  A warnings are
	  printed when compiling.  Note: previously "\a" was
	  incorrectly translated to 'a' instead of an <alert> (i.e.,
	  BELL, typically 0x07).

	* Make this compile with "-Wall -Wextra" and all the warning
	  flags used with WARNS=4 in the NetBSD source.  Also make it
	  pass lint.

	* Many "cleanups" and hopefully not too many new bugs!

2007-01-16 14:56 Anon Ymous <>

	* make several more files compile with gcc warnings
	  on and also make them pass lint.

2007-01-16 14:54 Anon Ymous <>

	* fix a puts()/putc() usage goof in file.c

	* make file.c compile with gcc warnings and pass lint

2006-12-11 16:49 Christos Zoulas <>

	* fix byteswapping issue

	* report the number of bytes we tried to
	  allocate when allocation fails

	* add a few missed cases in the strength routine

2006-12-08 16:32 Christos Zoulas <>

	* store and print the line number of the magic
	  entry for debugging.

	* if the magic entry did not print anything,
	  don't treat it as a match

	* change the magic strength algorithm to take
	  into account the relationship op.

	* fix a bug in search where we could accidentally
	  return a match.

	* propagate the error return from match to

2006-11-25 13:35 Christos Zoulas <>

	* Don't store the current offset in the magic
	  struct, because it needs to be restored and
	  it was not done properly all the time. Bug
	  found by: Arkadiusz Miskiewicz

	* Fix problem in the '\0' separator; and don't
	  print it as an additional separator; print
	  it as the only separator.

2006-11-17 10:51 Christos Zoulas <>

	* Added a -0 option to print a '\0' separator
	  Etienne Buira <>

2006-10-31 15:14 Christos Zoulas <>

	* Check offset before copying (Mike Frysinger)

	* merge duplicated code

	* add quad date support

	* make sure that we nul terminate desc (Ryoji Kanai)

	* don't process elf notes multiple times

	* allow -z to report empty compressed files

	* use calloc to initialize the ascii buffers (Jos van den Oever)

2006-06-08 11:11 Christos Zoulas <>

	* QNX fixes (Mike Gorchak)

	* Add quad support.

	* FIFO checks (Dr. Werner Fink)

	* Linux ELF fixes (Dr. Werner Fink)

	* Magic format checks (Dr. Werner Fink)

	* Magic format function improvent (Karl Chen)

2006-05-03 11:11 Christos Zoulas <>

	* Pick up some elf changes and some constant fixes from SUSE

	* Identify gnu tar vs. posix tar

	* When keep going, don't print spurious newlines (Radek Vokál)

2006-04-01 12:02 Christos Zoulas <>

	* Use calloc instead of malloc (Mike Frysinger)

	* Fix configure script to detect wctypes.h (Mike Frysinger)

2006-03-02 16:06 Christos Zoulas <>

	* Print empty if the file is (Mike Frysinger)

	* Don't try to read past the end of the buffer (Mike Frysinger)

	* Sort magic entries by strength [experimental]

2005-11-29 13:26 Christos Zoulas <>

	* Use iswprint() to convert the output string.
	    (Bastien Nocera)

2005-10-31 8:54 Christos Zoulas <>

	* Fix regression where the core info was not completely processed
	    (Radek Vokál)

2005-10-20 11:15 Christos Zoulas <>

	* Middle Endian magic (Diomidis Spinellis)

2005-10-17 11:15 Christos Zoulas <>

	* Open with O_BINARY for CYGWIN (Corinna Vinschen)

	* Don't close stdin (Arkadiusz Miskiewicz)

	* Look for note sections in non executables.

2005-09-20 13:33 Christos Zoulas <>

	* Don't print SVR4 Style in core files multiple times
	    (Radek Vokál)

2005-08-27 04:09 Christos Zoulas <>

	* Cygwin changes Corinna Vinschen

2005-08-18 09:53 Christos Zoulas <>

	* Remove erroreous mention of /etc/magic in the file man page
	  This is gentoo bug 101639. (Mike Frysinger)

	* Cross-compile support and detection (Mike Frysinger)

2005-08-12 10:17 Christos Zoulas <>

	* Add -h flag and dereference symlinks if POSIXLY_CORRECT
	  is set.

2005-07-29 13:57 Christos Zoulas <>

	* Avoid search and regex buffer overflows (Kelledin)

2005-07-12 11:48 Christos Zoulas <>

	* Provide stub implementations for {v,}nsprintf() for older
	  OS's that don't have them.
	* Change mbstate_t autoconf detection macro from AC_MBSTATE_T

2005-06-25 11:48 Christos Zoulas <>

	* Dynamically allocate the string buffers and make the
	  default read size 256K.

2005-06-01 00:00 Joerg Sonnenberger <>

	* Dragonfly ELF note support

2005-03-14 00:00 Giuliano Bertoletti <>

	* Avoid NULL pointer dereference in time conversion.

2005-03-06 00:00  Joerg Walter <>

	* Add indirect magic offset support, and search mode.

2005-01-12 00:00  Stepan Kasal  <>

	* src/ascmagic.c (file_ascmagic): Fix three bugs about text files:
	  If a CRLF text file happens to have CR at offset HOWMANY - 1
	  (currently 0xffff), it should not be counted as CR line
	  If a line has length exactly MAXLINELEN, it should not yet be
	  treated as a ``very long line'', as MAXLINELEN is ``longest sane
	  line length''.
	  With CRLF, the line length was not computed correctly, and even
	  lines of length MAXLINELEN - 1 were treated as ``very long''.

2004-12-07 14:15  Christos Zoulas  <>

	* bzip2 needs a lot of input buffer space on some files
	  before it can begin uncompressing. This makes file -z
	  fail on some bz2 files. Fix it by giving it a copy of
	  the file descriptor to read as much as it wants if we
	  have access to it. <>

2004-11-24 12:39  Christos Zoulas  <>

	* Stack smash fix, and ELF more conservative reading.
	  Jakub Bogusz <>

2004-11-20 18:50  Christos Zoulas  <>

	* New FreeBSD version parsing code:
	  Jon Noack <>

	* Hackish support for ucs16 strings <>

2004-11-13 03:07  Christos Zoulas  <>

	* print the file name and line number in syntax errors.

2004 10-12 10:50  Christos Zoulas  <>

	* Fix stack overwriting on 0 length strings: Tim Waugh
	    <> Ned Ludd <>

2004-09-27 11:30  Christos Zoulas  <>

	* Remove 3rd and 4th copyright clause; approved by Ian Darwin.

	* Fix small memory leaks; caught by: Tamas Sarlos

2004-07-24 16:33  Christos Zoulas  <>

	* magic.mime update Danny Milosavljevic <>

	* FreeBSD version update Oliver Eikemeier <>

	* utime/utimes detection Ian Lance Taylor <>

  	* errors reading elf magic Jakub Bogusz <>

2004-04-12 10:55  Christos Zoulas  <>

	* make sure that magic formats match magic types during compilation

	* fix broken sgi magic file

2004-04-06 20:36  Christos Zoulas  <>

	* detect present of mbstate_t Petter Reinholdtsen <>

	* magic fixes

2004-03-22 15:25  Christos Zoulas  <>

	* Lots of mime fixes
	  (Joerg Ostertag) <>

	* FreeBSD ELF version handling
	  (Edwin Groothuis) <>

	* correct cleanup in all cases; don't just close the file.
	  (Christos Zoulas) <>

	* add gettext message catalogue support
	  (Michael Piefel) <>

	* better printout for unreadable files
	  (Michael Piefel) <>

	* compensate for missing MAXPATHLEN
	  (Michael Piefel) <>

	* add wide character string length computation
	  (Michael Piefel) <>

	* Avoid infinite loops caused by bad elf alignments
	  or name and description note sizes. Reported by
	  (Mikael Magnusson) <>

2004-03-09 13:55  Christos Zoulas  <>

	* Fix possible memory leak on error and add missing regfree
	  (Dmitry V. Levin) <>

2003-12-23 12:12  Christos Zoulas  <>

	* fix -k flag (Maciej W. Rozycki)

2003-11-18 14:10  Christos Zoulas  <>

	* Try to give us much info as possible on corrupt elf files.
	  (Willy Tarreau) <>
	* Updated python bindings (Brett Funderburg)

2003-11-11 15:03  Christos Zoulas  <>

	* Include file.h first, because it includes config.h
	  breaks largefile test macros otherwise.
	  (Paul Eggert <eggert@CS.UCLA.EDU> via
	   Lars Hecking <>)

2003-10-14 21:39  Christos Zoulas  <>

	* Python bindings (Brett Funderburg) <>
	* Don't lookup past the end of the buffer
	  (Chad Hanson) <>
	* Add MAGIC_ERROR and api on magic_errno()

2003-10-08 12:40  Christos Zoulas  <>

	* handle error conditions from compile as fatal
	  (Antti Kantee) <>
	* handle magic filename parsing sanely
	* more magic fixes.
	* fix a memory leak (Illes Marton) <>
	* describe magic file handling
	  (Bryan Henderson) <>

2003-09-12 15:09  Christos Zoulas  <>

	* update magic files.
	* remove largefile support from file.h; it breaks things on most OS's

2003-08-10 10:25  Christos Zoulas  <>

	* fix unmapping'ing of mmaped files.

2003-07-10 12:03  Christos Zoulas  <>

	* don't exit with -1 on error; always exit 1 (Marty Leisner)
	* restore utimes code.

2003-06-10 17:03  Christos Zoulas  <>

	* make sure we don't access uninitialized memory.
	* pass lint
	* #ifdef __cplusplus in magic.h

2003-05-25 19:23  Christos Zoulas  <>

	* rename cvs magic file to revision to deal with
	  case insensitive filesystems.

2003-05-23 17:03  Christos Zoulas  <>

	* documentation fixes from Michael Piefel <>
	* magic fixes (various)
	* revert basename magic in .mgc name determination
	* buffer protection in uncompress,
	  signness issues,
	  close files
	  Maciej W. Rozycki <

2003-04-21 20:12  Christos Zoulas  <>

	* fix zsh magic

2003-04-04 16:59  Christos Zoulas  <>

	* fix operand sort order in string.

2003-04-02 17:30  Christos Zoulas  <>

	* cleanup namespace in magic.h

2003-04-02 13:50  Christos Zoulas  <>

	* Magic additions (Alex Ott)
	* Fix bug that broke VPATH compilation (Peter Breitenlohner)

2003-03-28 16:03  Christos Zoulas  <>

	* remove packed attribute from magic struct.
	* make the magic struct properly aligned.
	* bump version number of compiled files to 2.

2003-03-27 13:10  Christos Zoulas  <>

	* separate tar detection and run it before softmagic.
	* fix reversed symlink test.
	* fix version printing.
	* make separator a string instead of a char.
	* update manual page and sort options.

2003-03-26 11:00  Christos Zoulas  <>

	* Pass lint
	* make NULL in magic_file mean stdin
	* Fix "-" argument to file to pass NULL to magic_file
	* avoid pointer casts by using memcpy
	* rename magic_buf -> magic_buffer
	* keep only the first error
	* manual page: new sentence, new line
	* fix typo in api function (magic_buf -> magic_buffer)