]> git.ipfire.org Git - thirdparty/curl.git/commit
libssh/sftp: fix resume corruption by avoiding O_APPEND with rresume
authorJoshua Rogers <MegaManSec@users.noreply.github.com>
Wed, 8 Oct 2025 22:03:08 +0000 (06:03 +0800)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 9 Oct 2025 06:30:09 +0000 (08:30 +0200)
commit391e3fbeeccb7311562f60fbd9db964bc5bf3ec7
treecd1203ee5c0f2ed37d10c12a9f2459fe1f2b1b1c
parentc0a279a8e91a279f6942775073d21d0e93041af6
libssh/sftp: fix resume corruption by avoiding O_APPEND with rresume

Opening the remote file with O_APPEND while attempting to resume causes
all writes to be forced to EOF on servers/implementations where O_APPEND
semantics override a prior seek(). As a result, sftp_seek64() is ignored
and the resumed data is appended, duplicating/corrupting the file.

Fix by:
- Using O_WRONLY (without O_APPEND) when resume_from > 0.
- Skipping the seek entirely if remote_append mode is requested.

Closes #18952
lib/vssh/libssh.c