Skip to content

SFTP put text file overwrite bug #229

@gr9

Description

@gr9

openssh version: 5_15_2016 (x64)
OS Version: Windows Server 2012 datacenter edition (azure)
SFTP Clients Tested: FileZilla (OS X), sftp OS X, WinSCP (windows 10)
Logs: nothing pertinent in sshd_logs or windows event viewer

When overwriting a text file (and possibly binary?) using any of these clients or client OS's, if the new text file is shorter (less characters/lines) than the file to be overwritten - then the difference in file length will be appended to the new file from the old file.

Steps to reproduce:

1)create a file called test.txt with the following contents:
one

two three
four
five.

2)Upload said file to the server using any of the client's listed above. If you log into the server using RDP & open the file directly on the server - you should see it uploads correctly.

  1. Edit the text file by reducing the number of lines/characters to the following:
    on
    two th
    four
    five.

  2. Upload the file again to the server - making sure to confirm the overwrite

  3. Log directly into the server again using RDP and open the file again using a text editor directly on the server & review contents of the overwritten file; you should see the following instead of what was entered in step 3 (note the extra 'five.' appended on a new line):
    on
    two th
    four
    five.
    five.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions