Bug 13527 - cli_splice() fallback code reads wrong amount on termination case.
Summary: cli_splice() fallback code reads wrong amount on termination case.
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: libsmbclient (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
Depends on:
Reported: 2018-07-12 17:51 UTC by Jeremy Allison
Modified: 2018-08-14 11:05 UTC (History)
1 user (show)

See Also:

git-am fix for 4.8.next (9.80 KB, patch)
2018-07-13 23:09 UTC, Jeremy Allison
ddiss: review+
git-am fix for 4.7.next. (9.83 KB, patch)
2018-07-13 23:10 UTC, Jeremy Allison
ddiss: review+

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Allison 2018-07-12 17:51:48 UTC
Pointed out by <baileyberro@google.com>, this code always reads in SPLICE_BLOCK_SIZE chunks, whereas at the last chunk it should read only the remaining requested.

This works when reaching end-of-file because the cli_read() is truncated by the server, but when the splice copy is smaller than end-of-file, we read more bytes (SPLIC_BLOCK_SIZE - remaining) than needed.

Patch to follow.
Comment 1 Jeremy Allison 2018-07-13 23:09:45 UTC
Created attachment 14323 [details]
git-am fix for 4.8.next

Cherry-pick and squash from master.
Comment 2 Jeremy Allison 2018-07-13 23:10:24 UTC
Created attachment 14324 [details]
git-am fix for 4.7.next.

Back-port from master.
Comment 3 David Disseldorp 2018-07-15 12:59:27 UTC
@Karo: please merge for 4.7.next and 4.8.next.
Comment 4 Karolin Seeger 2018-07-28 04:06:27 UTC
(In reply to David Disseldorp from comment #3)
Pushed to autobuild-v4-{8,7}-test.
Comment 5 Karolin Seeger 2018-08-14 11:05:49 UTC
Pushed to both branches.
Closing out bug report.