Skip to content

Net/SCP::get() adds a one-byte chr(0) at the end of the saved file #146

@DavidAnderson684

Description

@DavidAnderson684

In my testing, I just have a simple usage of Net_SCP::get(), with the second parameter ($local_file) set to true.

The resulting file is one byte larger than the file being fetched. Using "hexdump -C" shows that the difference is an extra chr(0) at the end of the file.

Testing shows that the server sends back the correct size in the line checked with preg_match() in get(). So, it looks to me like the while loop (while ($size < $info['size']) {) needs to make sure that it truncates $data such that the indicated amount of data isn't exceeded. (Presumably the protocol adds a the chr(0) - get() just needs to make sure it doesn't read that far).

On an entirely different matter - have you considered adding the FISH protocol? (http://en.wikipedia.org/wiki/Files_transferred_over_shell_protocol)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions