Skip to content

Buffer overflow in match_hash_tokens(), when checking filename with 20 characters Mac OS stack protection aborts the program #300

@akda5id

Description

@akda5id

I've got an odd one here. When I check a .sfv that contains a filename with 20 characters in the stem of the filename (before the first '.'), RHash v1.4.6 will error out at that line with "zsh: abort".

Edit: ignore the following testing notes, and see the first comment below, there is a off by one buffer overflow in match_hash_tokens().

If I change the filename but check the same file, it completes as expected, so it doesn't seem to be a problem with the file. In fact I can repro this with any filename, existing or not, with 20 characters in the base part of the name. But of course this doesn't happen on a linux box built from source. I have verified on osx built from head of this repo, and also installed from homebrew.

I would suspect that it is trying to check if it is a valid hash instead of a filename, and hitting some error there and dumping out. This is despite me specifying crc32 on the command line (rhash -cC problem.sfv).

Some testing:
01234567890123456789.anything errors
01234567890123456789A.anything is fine, as is 0123456789012345678.anything
anydir/01234567890123456789.anything is fine, but:
01234567890123456789/anything.anything errors.
note that I am using the string 01234567890123456789, but any 20 character string works, including strings that have non base64 characters in it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdoneThe issue is fixed/applied/implemented

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions