[File] [PATCH] Fix 2 missing space delimiters in "magic/Magdir/console".

Michael T. Kloos michael at michaelkloos.com
Sun Oct 22 22:27:49 UTC 2023


I am not an NES expert.  However, I noticed that I was getting erronious
results when running file over some C source code containing the text
"IMA" at exactly file offset 0x100.  It claimed it was a
"Samsung Pico ROM image".  Actually, the output contained what looked like
garbage prepended: "IKUNOJYUKU\011\011Samsung Pico ROM image"

I did some research on the file command and the magic file configuration
and found these lines withing the afformationed console file.  It looks
like it is missing delimiters within the comparison string and, therefore,
matching very little text.  The remaining parts of the comparison string
are then bleeding into the output string.

I also noticed that a few lines below, the syntax and style suggests a
similar error is present.

I have therefore added delmiters both places.

However, as I am unfamilar with these binary images, I can not confirm that
this is intended behavior.  I would ask that someone more familar look at this
before commiting.

Signed-off-by: Michael T. Kloos <michael at michaelkloos.com>
---
 magic/Magdir/console | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/magic/Magdir/console b/magic/Magdir/console
index 0ed53fe3..e8d61e12 100644
--- a/magic/Magdir/console
+++ b/magic/Magdir/console
@@ -269,13 +269,13 @@
 0x100		string	IMA\ IKUNOUJYUKU	Samsung Pico ROM image
 !:mime		application/x-sega-pico-rom
 >0		use	sega-mega-drive-header
-0x100		string	IMA IKUNOJYUKU		Samsung Pico ROM image
+0x100		string	IMA\ IKUNOJYUKU		Samsung Pico ROM image
 !:mime		application/x-sega-pico-rom
 >0		use	sega-mega-drive-header
 
 # Sega Picture Magic (modified 32X)
 0x100		string	Picture\ Magic
->0x3C0		string	PICTURE MAGIC-01	Sega 32X ROM image
+>0x3C0		string	PICTURE\ MAGIC-01	Sega 32X ROM image
 !:mime		application/x-genesis-32x-rom
 >>0		use	sega-mega-drive-header
 
-- 
2.41.0



More information about the File mailing list