From 6ebd0ba735e6fdddc4d7ded57879d85a42aabf05 Mon Sep 17 00:00:00 2001 From: Noel Power Date: Tue, 13 Aug 2019 15:57:22 +0100 Subject: s3/libsmb: clang: Fix 'the left operand of '-' is a garbage value' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: source3/libsmb/clifile.c:360:19: warning: The left operand of '-' is a garbage value <--[clang] if (data[num_data-1] != '\0') { ~~~~~~~~^ Signed-off-by: Noel Power Reviewed-by: Ralph Boehme Autobuild-User(master): Ralph Böhme Autobuild-Date(master): Tue Oct 22 18:48:43 UTC 2019 on sn-devel-184 --- source3/libsmb/clifile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/libsmb') diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 987b04d0a66..dd08b0e30f3 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -344,7 +344,7 @@ static void cli_posix_readlink_done(struct tevent_req *subreq) req, struct cli_posix_readlink_state); NTSTATUS status; uint8_t *data = NULL; - uint32_t num_data; + uint32_t num_data = 0; charset_t charset; size_t converted_size; bool ok; @@ -357,7 +357,7 @@ static void cli_posix_readlink_done(struct tevent_req *subreq) /* * num_data is > 1, we've given 1 as minimum to cli_qpathinfo_send */ - if (data[num_data-1] != '\0') { + if (data == NULL || data[num_data-1] != '\0') { tevent_req_nterror(req, NT_STATUS_DATA_ERROR); return; } -- cgit v1.2.1