[PATCH] Initialize value of written in cli_splice_fallback
Jeremy Allison
jra at samba.org
Fri Jul 6 18:53:08 UTC 2018
On Tue, Jul 03, 2018 at 07:57:23AM -0600, David Mulder via samba-technical wrote:
> I agree this approach looks better.
> rb+
This looks OK, but we also need an additional patch
in source3/libsmb/libsmb_file.c that initializes
written to zero, as all other uses. Plus we need
a bug report for this.
I've logged one:
https://bugzilla.samba.org/show_bug.cgi?id=13511
Attached is the complete patch I'm happy with.
Bailey, I've also added a 'Signed-off-by:' line
from you. As this is a small patch I think this
is OK, but if you want to also send in the
Samba DCO as defined here:
https://www.samba.org/samba/devel/copyright-policy.html
I won't object :-). Can you confirm you're OK
with this change ?
Once you've OK'ed it can I get a second Team
reviewer ?
Thanks,
Jeremy.
-------------- next part --------------
From c1fd934123ea07cfded853525668028808f2c2ec Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Fri, 6 Jul 2018 11:46:44 -0700
Subject: [PATCH 1/2] libsmbclient: Initialize written value before use.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13511
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/libsmb/libsmb_file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source3/libsmb/libsmb_file.c b/source3/libsmb/libsmb_file.c
index 6b436768ecb..ebd0bfe422a 100644
--- a/source3/libsmb/libsmb_file.c
+++ b/source3/libsmb/libsmb_file.c
@@ -298,7 +298,7 @@ SMBC_splice_ctx(SMBCCTX *context,
int (*splice_cb)(off_t n, void *priv),
void *priv)
{
- off_t written;
+ off_t written = 0;
TALLOC_CTX *frame = talloc_stackframe();
NTSTATUS status;
--
2.18.0.203.gfac676dfb9-goog
From a6b9197717f672b2b0b3f9f25fd0130b93774390 Mon Sep 17 00:00:00 2001
From: Bailey Berro <baileyberro at chromium.org>
Date: Tue, 26 Jun 2018 13:13:39 -0700
Subject: [PATCH 2/2] libsmbclient: Initialize written in cli_splice_fallback()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13511
Signed-off-by: Bailey Berro <baileyberro at chromium.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
---
source3/libsmb/clireadwrite.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c
index 39874779bc1..00ee09ece89 100644
--- a/source3/libsmb/clireadwrite.c
+++ b/source3/libsmb/clireadwrite.c
@@ -1459,6 +1459,7 @@ static NTSTATUS cli_splice_fallback(TALLOC_CTX *frame,
uint8_t *buf = talloc_size(frame, SPLICE_BLOCK_SIZE);
size_t nread;
off_t remaining = initial_size;
+ *written = 0;
while (remaining) {
status = cli_read(srccli, src_fnum,
@@ -1480,6 +1481,7 @@ static NTSTATUS cli_splice_fallback(TALLOC_CTX *frame,
}
src_offset += nread;
dst_offset += nread;
+ *written += nread;
if (remaining < nread) {
return NT_STATUS_INTERNAL_ERROR;
}
--
2.18.0.203.gfac676dfb9-goog
More information about the samba-technical
mailing list