sftp: fix range downloads in both SSH backends

When asking for the last N bytes of a file, and that size was larger
than the file size, it would miss the first byte due to a logic error.

The fixed range parser is now made a common function in the file now
renamed to vssh.c (from curl_path.c) - used by both backends.

Unit test 2605 verifies the parser.

Reported-by: Stanislav Fort (Aisle Research)
Closes #19460
This commit is contained in:
Daniel Stenberg 2025-11-11 09:42:16 +01:00
parent 67ef4a34f2
commit c545e10fa7
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
12 changed files with 204 additions and 84 deletions

View file

@ -36,7 +36,7 @@
#include <libssh/sftp.h>
#endif
#include "curl_path.h"
#include "vssh.h"
/* meta key for storing protocol meta at easy handle */
#define CURL_META_SSH_EASY "meta:proto:ssh:easy"