canon-mf644 icon indicating copy to clipboard operation
canon-mf644 copied to clipboard

loaders-canon.py parsing issue

Open int3rsys opened this issue 2 years ago • 0 comments

Hey there, While extracting the firmware, it seems that towards the end bytesIO returns NoneType when 4 bytes are read from the stream:

def peek_magic(stream):
    """ retrieve block type """
    try:
        magic = unpack("<4s", stream.read(Container.MAGIC_SIZE))[0]
        stream.seek(-Container.MAGIC_SIZE, 1) # os.SEEK_SET)
        return magic
    except error:
        return None

I've fixed that we type checking for the stream.read() results.

int3rsys avatar Jun 10 '22 11:06 int3rsys