Skip to content

Windows getpass doesn't update passLength, nor null-terminates the string #13

@jjr90

Description

@jjr90

I was able to install the DokanSetup.exe from the "msvc" subdir to launch hdimount on Windows.

However, for the same exact DMG file that Linux hdimount can mount correctly, the Windows hdimount is saying "Error: Not encrypted or wrong password."

I think I might've found the issue.

In the Windows version of getpass, the passLength is never updated, so it stays at 0 and keeps writing the console input to index 0.
Not only that, but it looks like it never NULL-terminates the string afterward (update: thus the password retains the RETURN at the end.)

while (passLength < sizeof(pass) && ReadConsoleA(hIn, &pass[passLength], 1, &dwRead, NULL) && pass[passLength] != RETURN )

[snipped]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions