From: Douglas Bagnall Date: Wed, 8 May 2019 04:46:33 +0000 (+1200) Subject: s4/policy/gp_filesys: avoid SIZE_MAX smbcli write (CID 1034779) X-Git-Tag: tdb-1.4.1~108 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=79629b42cde3fd1e932677d6388cff90a2cc3cd2;p=thirdparty%2Fsamba.git s4/policy/gp_filesys: avoid SIZE_MAX smbcli write (CID 1034779) Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/source4/lib/policy/gp_filesys.c b/source4/lib/policy/gp_filesys.c index 267762dd27d..69fb143c687 100644 --- a/source4/lib/policy/gp_filesys.c +++ b/source4/lib/policy/gp_filesys.c @@ -482,6 +482,12 @@ static NTSTATUS push_recursive (struct gp_context *gp_ctx, const char *local_pat } total_read = 0; while ((nread = read(local_fd, &buf, sizeof(buf)))) { + if (nread == -1) { + DBG_ERR("read failed with errno %s\n", + strerror(errno)); + status = NT_STATUS_UNSUCCESSFUL; + goto done; + } smbcli_write(gp_ctx->cli->tree, remote_fd, 0, &buf, total_read, nread); total_read += nread;