The branch, master has been updated via c4613521723 s3/lib/smbconf: clang: 'Value stored during its initialization is never read' via b388c217d4f s3/lib: clang: 'Value stored to 'rta' is never read' via 963f58fb622 s3/registry: clang: Fix 'initialization value is never read' via 80e57a10164 s3/registry: clang: Fix 'initialization value is never read' via e3e9330609b s3/lib: clang: Fix 'passed-by-value struct argument contains uninit-ed data' via 6ea9c795b13 libcli/smb: clang: Fix ' 2nd function call argument is an uninitialized value' via fb49e411aa3 libcli/smb: clang: Fix 'Dereference of null pointer' via 3594c3ae202 libcli/smb: clang: Fix 'Array access results in a null pointer deref' via 7a86c99ccb6 libcli/smb: clang: Fix 'array access results in a null pointer deref' via 7b8ec24ccfb s4/libcli/raw: Fix 'Value stored to 'p' is never read' via 4f61a9980db s3/param: clang: Fix 'Value stored to 'bRetval' is never read' via 06c3a493d99 s4/libcli/raw: clang: Fix 'initialization value is never read' via be319e24bb9 s4/libcli: clang: Fix 'initialization value is never read' via a901c5768ac libcli/cldap: clang: Fix 'Dereference of null pointer' via 9cfdb9f1906 libcls/netlogon: clang: Fix 'initialization value is never read' via 8aed7e9aae1 s4/libcli/ldab: clang: Fix 'Access results in a deref of a null pointer' via 80f5461ae6c s3/lib: clang: Fix 'Value stored to 'b' is never read' via 0ca6d34a69d s3/lib/dwrap: clang: Fix 'Array access results in a null pointer dereference' via 57e9b358ec8 s3/lib: clang: Fix 'Value stored during its initialization is never read' from 9cf3379a140 third_party: Update uid_wrapper to version 1.2.7
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit c4613521723e3ab9b462d75485a514ca16595226 Author: Noel Power <noel.po...@suse.com> Date: Wed Jul 10 11:50:18 2019 +0000 s3/lib/smbconf: clang: 'Value stored during its initialization is never read' Fixes: source3/lib/smbconf/smbconf_reg.c:123:9: warning: Value stored to 'werr' during its initialization is never read <--[clang] WERROR werr = WERR_OK; ^~~~ ~~~~~~~ source3/lib/smbconf/smbconf_reg.c:178:9: warning: Value stored to 'werr' during its initialization is never read <--[clang] WERROR werr = WERR_OK; ^~~~ ~~~~~~~ source3/lib/smbconf/smbconf_reg.c:444:9: warning: Value stored to 'werr' during its initialization is never read <--[clang] WERROR werr = WERR_OK; ^~~~ ~~~~~~~ source3/lib/smbconf/smbconf_reg.c:583:9: warning: Value stored to 'werr' during its initialization is never read <--[clang] WERROR werr = WERR_OK; ^~~~ ~~~~~~~ source3/lib/smbconf/smbconf_reg.c:712:9: warning: Value stored to 'werr' during its initialization is never read <--[clang] WERROR werr = WERR_OK; ^~~~ ~~~~~~~ source3/lib/smbconf/smbconf_reg.c:995:9: warning: Value stored to 'werr' during its initialization is never read <--[clang] WERROR werr = WERR_OK; ^~~~ ~~~~~~~ source3/lib/smbconf/smbconf_reg.c:1103:9: warning: Value stored to 'werr' during its initialization is never read <--[clang] WERROR werr = WERR_OK; ^~~~ ~~~~~~~ 7 warnings generated. Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> Autobuild-User(master): Gary Lockyer <g...@samba.org> Autobuild-Date(master): Wed Jul 17 00:07:48 UTC 2019 on sn-devel-184 commit b388c217d4fa0d2451a5d949b4fdf5a778d814a1 Author: Noel Power <noel.po...@suse.com> Date: Wed Jul 10 11:45:01 2019 +0000 s3/lib: clang: 'Value stored to 'rta' is never read' Fixes: source3/lib/addrchange.c:217:2: warning: Value stored to 'rta' is never read <--[clang] rta = IFA_RTA(ifa); ^ ~~~~~~~~~~~~ 1 warning generated. Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> commit 963f58fb622f20d58f9dab2d5f474c7eec58a8e2 Author: Noel Power <noel.po...@suse.com> Date: Wed Jul 10 11:35:35 2019 +0000 s3/registry: clang: Fix 'initialization value is never read' Fixes: source3/registry/reg_backend_db.c:853:9: warning: Value stored to 'result' during its initialization is never read <--[clang] WERROR result = WERR_OK; ^~~~~~ ~~~~~~~ source3/registry/reg_backend_db.c:1677:2: warning: Value stored to 'len' is never read <--[clang] len = 0; ^ ~ 2 warnings generated. Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> commit 80e57a10164cc8482f0611cbce4086521051ec9b Author: Noel Power <noel.po...@suse.com> Date: Wed Jul 10 11:26:06 2019 +0000 s3/registry: clang: Fix 'initialization value is never read' Fixes: source3/registry/reg_api.c:139:14: warning: Value stored to 'result' during its initialization is never read <--[clang] WERROR result = WERR_OK; ^~~~~~ ~~~~~~~ ource3/registry/reg_api.c:958:9: warning: Value stored to 'werr' during its initialization is never read <--[clang] WERROR werr = WERR_OK; ^~~~ ~~~~~~~ 2 warnings generated. Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> commit e3e9330609b527a101dfde9a1109da7cb389ed32 Author: Noel Power <noel.po...@suse.com> Date: Wed Jul 10 11:22:43 2019 +0000 s3/lib: clang: Fix 'passed-by-value struct argument contains uninit-ed data' Fixed: g_lock.c:358:21: warning: Passed-by-value struct argument contains uninitialized data (e.g., field: 'pid') <--[clang] state->watch_req = dbwrap_watched_watch_send( ^ 1 warning generated. Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> commit 6ea9c795b138ebaee40f0ab7d7741cab236cec96 Author: Noel Power <noel.po...@suse.com> Date: Wed Jul 10 10:46:44 2019 +0000 libcli/smb: clang: Fix ' 2nd function call argument is an uninitialized value' Fixes: /home/samba/samba/libcli/smb/smbXcli_base.c:5120:8: warning: 2nd function call argument is an uninitialized value <--[clang] rc = gnutls_hash(hash_hnd, Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> commit fb49e411aa3ca397b19ea57528c2f67f9b85c877 Author: Noel Power <noel.po...@suse.com> Date: Wed Jul 10 10:41:29 2019 +0000 libcli/smb: clang: Fix 'Dereference of null pointer' Fixes: smbXcli_base.c:4885:20: warning: Dereference of null pointer <--[clang] body = (uint8_t *)iov[1].iov_base; ^~~~~~~~~~~~~~~ Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> commit 3594c3ae202688fd8aae5f7f5e20464cb23feea9 Author: Noel Power <noel.po...@suse.com> Date: Wed Jul 10 10:37:34 2019 +0000 libcli/smb: clang: Fix 'Array access results in a null pointer deref' Fixes: smbXcli_base.c:4393:10: warning: Array access (from variable 'inhdr') results in a null pointer dereference <--[clang] flags = CVAL(inhdr, HDR_FLG); Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> commit 7a86c99ccb6912effdbb0ffbdc5c66eccf8c1aa2 Author: Noel Power <noel.po...@suse.com> Date: Wed Jul 10 10:22:49 2019 +0000 libcli/smb: clang: Fix 'array access results in a null pointer deref' Fixes: smbXcli_base.c:1239:9: warning: Array access (via field 'pending') results in a null pointer dereference <--[clang] req = conn->pending[0]; ^ Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> commit 7b8ec24ccfb06c1d499bf500183c0dc24de553a0 Author: Noel Power <noel.po...@suse.com> Date: Thu Jul 11 12:00:27 2019 +0000 s4/libcli/raw: Fix 'Value stored to 'p' is never read' Fixes: source4/libcli/raw/clitree.c:138:3: warning: Value stored to 'p' is never read <--[clang] p += smbcli_req_pull_string(&req->in.bufinfo, mem_ctx, &parms->tconx.out.fs_type, ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> commit 4f61a9980dbd23774e7d0c205e59dc6c593067dd Author: Noel Power <noel.po...@suse.com> Date: Thu Jul 11 11:36:46 2019 +0000 s3/param: clang: Fix 'Value stored to 'bRetval' is never read' Fixes: source3/param/loadparm.c:2770:2: warning: Value stored to 'bRetval' is never read <--[clang] bRetval = false; ^ ~~~~~ source3/param/loadparm.c:3868:2: warning: Value stored to 'bRetval' is never read <--[clang] bRetval = false; ^ ~~~~~ 2 warnings generated. Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> commit 06c3a493d99846af62c185a9db1a6823726ac1fc Author: Noel Power <noel.po...@suse.com> Date: Thu Jul 11 11:33:18 2019 +0000 s4/libcli/raw: clang: Fix 'initialization value is never read' Fixes: source4/libcli/raw/rawnegotiate.c:157:11: warning: Value stored to 'status' during its initialization is never read <--[clang] NTSTATUS status = NT_STATUS_INTERNAL_ERROR; ^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> commit be319e24bb96ac4acbf55f36403f37af08107660 Author: Noel Power <noel.po...@suse.com> Date: Thu Jul 11 11:31:03 2019 +0000 s4/libcli: clang: Fix 'initialization value is never read' Fixes: source4/libcli/smb_composite/fetchfile.c:91:11: warning: Value stored to 'status' during its initialization is never read <--[clang] NTSTATUS status = NT_STATUS_UNSUCCESSFUL; ^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> commit a901c5768accd49b40b17b3350613ca7819a2854 Author: Noel Power <noel.po...@suse.com> Date: Thu Jul 11 11:28:58 2019 +0000 libcli/cldap: clang: Fix 'Dereference of null pointer' Fixes: libcli/cldap/cldap.c:144:8: warning: Dereference of null pointer <--[clang] ev = c->searches.list->caller.ev; ^ 1 warning generated. Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> commit 9cfdb9f190688682dd62d7c148f1d801921a3b92 Author: Noel Power <noel.po...@suse.com> Date: Wed Jul 10 16:34:56 2019 +0100 libcls/netlogon: clang: Fix 'initialization value is never read' Fixes: libcli/netlogon/netlogon.c:183:11: warning: Value stored to 'status' during its initialization is never read <--[clang] NTSTATUS status = NT_STATUS_INVALID_NETWORK_RESPONSE; ^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ libcli/netlogon/netlogon.c:224:11: warning: Value stored to 'status' during its initialization is never read <--[clang] NTSTATUS status = NT_STATUS_INVALID_NETWORK_RESPONSE; ^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 warnings generated. Note: although use of default seems unecessary but gcc (with --picky-developer) detects the possibiliy still that status may be undefined (presumably by a non enum value leaking into the switch) Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> commit 8aed7e9aae13b3fc64a2af1fbdf835f12038ac9b Author: Noel Power <noel.po...@suse.com> Date: Wed Jul 10 16:13:38 2019 +0100 s4/libcli/ldab: clang: Fix 'Access results in a deref of a null pointer' Fixes: source4/libcli/ldap/ldap_client.c:1023:6: warning: Access to field 'type' results in a dereference of a null pointer <--[clang] if ((*msg)->type != type) { ^~~~~~~~~~~~ Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> commit 80f5461ae6c9e7b443b6845ca9dc341d530a04dd Author: Noel Power <noel.po...@suse.com> Date: Wed Jul 10 16:07:35 2019 +0100 s3/lib: clang: Fix 'Value stored to 'b' is never read' Fixes: source3/lib/substitute.c:516:7: warning: Value stored to 'b' is never read <--[clang] for (b = s = a_string; (p = strchr_m(s, '%')); s = a_string + (p - b)) { ^ ~~~~~~~~~~~~ source3/lib/substitute.c:709:7: warning: Value stored to 'b' is never read <--[clang] for (b = s = a_string; (p = strchr_m(s, '%')); s = a_string + (p - b)) { ^ ~~~~~~~~~~~~ source3/lib/substitute.c:811:7: warning: Value stored to 'b' is never read <--[clang] for (b = s = a_string; (p = strchr_m(s, '%')); s = a_string + (p - b)) { ^ ~~~~~~~~~~~~ 3 warnings generated. Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> commit 0ca6d34a69d308ad756f3697f8f44a8e642b27f0 Author: Noel Power <noel.po...@suse.com> Date: Wed Jul 10 15:55:48 2019 +0100 s3/lib/dwrap: clang: Fix 'Array access results in a null pointer dereference' Fixes: source3/lib/dbwrap/dbwrap_watch.c:55:3: warning: Array access (from variable 'wkey') results in a null pointer dereference <--[clang] SIVAL(wkey, 0, db_id_len); ^ 1 warning generated. Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> commit 57e9b358ec836e8d8133242c0f6ce4d896531a40 Author: Noel Power <noel.po...@suse.com> Date: Wed Jul 10 15:49:11 2019 +0100 s3/lib: clang: Fix 'Value stored during its initialization is never read' Fixes: source3/lib/messages.c:483:11: warning: Value stored to 'status' during its initialization is never read <--[clang] NTSTATUS status = NT_STATUS_UNSUCCESSFUL; ^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> ----------------------------------------------------------------------- Summary of changes: libcli/cldap/cldap.c | 4 ++++ libcli/netlogon/netlogon.c | 8 ++++++-- libcli/smb/smbXcli_base.c | 13 +++++++------ source3/lib/addrchange.c | 1 - source3/lib/dbwrap/dbwrap_watch.c | 2 +- source3/lib/g_lock.c | 2 +- source3/lib/messages.c | 2 +- source3/lib/smbconf/smbconf_reg.c | 14 +++++++------- source3/lib/substitute.c | 6 +++--- source3/param/loadparm.c | 3 --- source3/registry/reg_api.c | 4 ++-- source3/registry/reg_backend_db.c | 21 +++++++++++---------- source4/libcli/ldap/ldap_client.c | 2 +- source4/libcli/raw/clitree.c | 2 +- source4/libcli/raw/rawnegotiate.c | 5 +++-- source4/libcli/smb_composite/fetchfile.c | 5 ++++- 16 files changed, 52 insertions(+), 42 deletions(-) Changeset truncated at 500 lines: diff --git a/libcli/cldap/cldap.c b/libcli/cldap/cldap.c index daba37a21d7..f609bf278e4 100644 --- a/libcli/cldap/cldap.c +++ b/libcli/cldap/cldap.c @@ -141,6 +141,10 @@ static bool cldap_recvfrom_setup(struct cldap_socket *c) ev = c->incoming.ev; if (ev == NULL) { + /* this shouldn't happen but should be protected against */ + if (c->searches.list == NULL) { + return false; + } ev = c->searches.list->caller.ev; } diff --git a/libcli/netlogon/netlogon.c b/libcli/netlogon/netlogon.c index 58a331d70ad..239503e85b6 100644 --- a/libcli/netlogon/netlogon.c +++ b/libcli/netlogon/netlogon.c @@ -180,7 +180,7 @@ void map_netlogon_samlogon_response(struct netlogon_samlogon_response *response) NTSTATUS push_nbt_netlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx, struct nbt_netlogon_response *response) { - NTSTATUS status = NT_STATUS_INVALID_NETWORK_RESPONSE; + NTSTATUS status; enum ndr_err_code ndr_err; switch (response->response_type) { case NETLOGON_GET_PDC: @@ -212,6 +212,9 @@ NTSTATUS push_nbt_netlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx, } status = NT_STATUS_OK; break; + default: + status = NT_STATUS_INVALID_NETWORK_RESPONSE; + break; } return status; @@ -221,7 +224,7 @@ NTSTATUS push_nbt_netlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx, NTSTATUS pull_nbt_netlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx, struct nbt_netlogon_response *response) { - NTSTATUS status = NT_STATUS_INVALID_NETWORK_RESPONSE; + NTSTATUS status; enum netlogon_command command; enum ndr_err_code ndr_err; if (data->length < 4) { @@ -273,6 +276,7 @@ NTSTATUS pull_nbt_netlogon_response(DATA_BLOB *data, TALLOC_CTX *mem_ctx, case LOGON_REQUEST: case NETLOGON_ANNOUNCE_UAS: case LOGON_SAM_LOGON_REQUEST: + default: status = NT_STATUS_INVALID_NETWORK_RESPONSE; } diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c index 2f5fac08128..98c928795ec 100644 --- a/libcli/smb/smbXcli_base.c +++ b/libcli/smb/smbXcli_base.c @@ -1229,7 +1229,8 @@ void smbXcli_conn_disconnect(struct smbXcli_conn *conn, NTSTATUS status) * conn->pending because that array changes in * smbXcli_req_unset_pending. */ - while (talloc_array_length(conn->pending) > 0) { + while (conn->pending != NULL && + talloc_array_length(conn->pending) > 0) { struct tevent_req *req; struct smbXcli_req_state *state; struct tevent_req **chain; @@ -4326,7 +4327,7 @@ static void smbXcli_negprot_smb1_done(struct tevent_req *subreq) struct smbXcli_negprot_state); struct smbXcli_conn *conn = state->conn; struct iovec *recv_iov = NULL; - uint8_t *inhdr; + uint8_t *inhdr = NULL; uint8_t wct; uint16_t *vwv; uint32_t num_bytes; @@ -4386,7 +4387,7 @@ static void smbXcli_negprot_smb1_done(struct tevent_req *subreq) NULL, /* pinbuf */ expected, ARRAY_SIZE(expected)); TALLOC_FREE(subreq); - if (tevent_req_nterror(req, status)) { + if (inhdr == NULL || tevent_req_nterror(req, status)) { return; } @@ -4850,7 +4851,7 @@ static void smbXcli_negprot_smb2_done(struct tevent_req *subreq) size_t security_offset, security_length; DATA_BLOB blob; NTSTATUS status; - struct iovec *iov; + struct iovec *iov = NULL; uint8_t *body; size_t i; uint16_t dialect_revision; @@ -4867,7 +4868,7 @@ static void smbXcli_negprot_smb2_done(struct tevent_req *subreq) uint16_t hash_selected; gnutls_hash_hd_t hash_hnd = NULL; struct smb2_negotiate_context *cipher = NULL; - struct iovec sent_iov[3]; + struct iovec sent_iov[3] = {{0}, {0}, {0}}; static const struct smb2cli_req_expected_response expected[] = { { .status = NT_STATUS_OK, @@ -4878,7 +4879,7 @@ static void smbXcli_negprot_smb2_done(struct tevent_req *subreq) status = smb2cli_req_recv(subreq, state, &iov, expected, ARRAY_SIZE(expected)); - if (tevent_req_nterror(req, status)) { + if (tevent_req_nterror(req, status) || iov == NULL) { return; } diff --git a/source3/lib/addrchange.c b/source3/lib/addrchange.c index 719b8702789..9a64e8d3a14 100644 --- a/source3/lib/addrchange.c +++ b/source3/lib/addrchange.c @@ -214,7 +214,6 @@ static void addrchange_done(struct tevent_req *subreq) state->addr.ss_family = ifa->ifa_family; - rta = IFA_RTA(ifa); len = h->nlmsg_len - sizeof(struct nlmsghdr) + sizeof(struct ifaddrmsg); found = false; diff --git a/source3/lib/dbwrap/dbwrap_watch.c b/source3/lib/dbwrap/dbwrap_watch.c index 9bf3d372621..6bbd68df859 100644 --- a/source3/lib/dbwrap/dbwrap_watch.c +++ b/source3/lib/dbwrap/dbwrap_watch.c @@ -51,7 +51,7 @@ static ssize_t dbwrap_record_watchers_key(struct db_context *db, return -1; } - if (wkey_len >= needed) { + if (wkey != NULL && wkey_len >= needed) { SIVAL(wkey, 0, db_id_len); memcpy(wkey + sizeof(uint32_t), db_id, db_id_len); memcpy(wkey + sizeof(uint32_t) + db_id_len, diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c index d97786b02a3..ef6bbb52613 100644 --- a/source3/lib/g_lock.c +++ b/source3/lib/g_lock.c @@ -347,7 +347,7 @@ struct g_lock_lock_fn_state { static void g_lock_lock_fn(struct db_record *rec, void *private_data) { struct g_lock_lock_fn_state *state = private_data; - struct server_id blocker; + struct server_id blocker = {0}; state->status = g_lock_trylock(rec, state->self, state->state->type, &blocker); diff --git a/source3/lib/messages.c b/source3/lib/messages.c index 699282cff88..a6bf99578b6 100644 --- a/source3/lib/messages.c +++ b/source3/lib/messages.c @@ -480,7 +480,7 @@ static NTSTATUS messaging_init_internal(TALLOC_CTX *mem_ctx, { TALLOC_CTX *frame; struct messaging_context *ctx; - NTSTATUS status = NT_STATUS_UNSUCCESSFUL; + NTSTATUS status; int ret; const char *lck_path; const char *priv_path; diff --git a/source3/lib/smbconf/smbconf_reg.c b/source3/lib/smbconf/smbconf_reg.c index d4a8b8c2989..c923f3b6820 100644 --- a/source3/lib/smbconf/smbconf_reg.c +++ b/source3/lib/smbconf/smbconf_reg.c @@ -120,7 +120,7 @@ static sbcErr smbconf_reg_open_service_key(TALLOC_CTX *mem_ctx, static bool smbconf_value_exists(struct registry_key *key, const char *param) { bool ret = false; - WERROR werr = WERR_OK; + WERROR werr; TALLOC_CTX *ctx = talloc_stackframe(); struct registry_value *value = NULL; @@ -175,7 +175,7 @@ static sbcErr smbconf_reg_set_value(struct registry_key *key, const char *valstr) { struct registry_value val; - WERROR werr = WERR_OK; + WERROR werr; sbcErr err; char *subkeyname; const char *canon_valname; @@ -441,7 +441,7 @@ static sbcErr smbconf_reg_get_values(TALLOC_CTX *mem_ctx, char ***value_strings) { TALLOC_CTX *tmp_ctx = NULL; - WERROR werr = WERR_OK; + WERROR werr; sbcErr err; uint32_t count; struct registry_value *valvalue = NULL; @@ -580,7 +580,7 @@ done: */ static sbcErr smbconf_reg_init(struct smbconf_ctx *ctx, const char *path) { - WERROR werr = WERR_OK; + WERROR werr; sbcErr err; struct security_token *token; @@ -709,7 +709,7 @@ static void smbconf_reg_get_csn(struct smbconf_ctx *ctx, static sbcErr smbconf_reg_drop(struct smbconf_ctx *ctx) { char *path, *p; - WERROR werr = WERR_OK; + WERROR werr; sbcErr err = SBC_ERR_OK; struct registry_key *parent_key = NULL; struct registry_key *new_key = NULL; @@ -992,7 +992,7 @@ static sbcErr smbconf_reg_get_parameter(struct smbconf_ctx *ctx, const char *param, char **valstr) { - WERROR werr = WERR_OK; + WERROR werr; sbcErr err; struct registry_key *key = NULL; struct registry_value *value = NULL; @@ -1100,7 +1100,6 @@ static sbcErr smbconf_reg_set_includes(struct smbconf_ctx *ctx, uint32_t num_includes, const char **includes) { - WERROR werr = WERR_OK; sbcErr err; struct registry_key *key = NULL; TALLOC_CTX *tmp_ctx = talloc_stackframe(); @@ -1112,6 +1111,7 @@ static sbcErr smbconf_reg_set_includes(struct smbconf_ctx *ctx, } if (num_includes == 0) { + WERROR werr; if (!smbconf_value_exists(key, INCLUDES_VALNAME)) { err = SBC_ERR_OK; goto done; diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c index ea227c5ab68..f8ca6f41cc1 100644 --- a/source3/lib/substitute.c +++ b/source3/lib/substitute.c @@ -513,7 +513,7 @@ char *talloc_sub_basic(TALLOC_CTX *mem_ctx, tmp_ctx = talloc_stackframe(); - for (b = s = a_string; (p = strchr_m(s, '%')); s = a_string + (p - b)) { + for (s = a_string; (p = strchr_m(s, '%')); s = a_string + (p - b)) { r = NULL; b = a_string; @@ -706,7 +706,7 @@ char *talloc_sub_specified(TALLOC_CTX *mem_ctx, goto done; } - for (b = s = a_string; (p = strchr_m(s, '%')); s = a_string + (p - b)) { + for (s = a_string; (p = strchr_m(s, '%')); s = a_string + (p - b)) { b = a_string; @@ -808,7 +808,7 @@ char *talloc_sub_advanced(TALLOC_CTX *ctx, return NULL; } - for (b = s = a_string; (p = strchr_m(s, '%')); s = a_string + (p - b)) { + for (s = a_string; (p = strchr_m(s, '%')); s = a_string + (p - b)) { b = a_string; diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index a8d5fdc5954..9e97d719f4e 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -2766,7 +2766,6 @@ bool lp_do_section(const char *pszSectionName, void *userdata) bool bRetval; bool isglobal = ((strwicmp(pszSectionName, GLOBAL_NAME) == 0) || (strwicmp(pszSectionName, GLOBAL_NAME2) == 0)); - bRetval = false; /* if we were in a global section then do the local inits */ if (bInGlobalSection && !isglobal) @@ -3864,8 +3863,6 @@ static bool lp_load_ex(const char *pszFname, TALLOC_CTX *frame = talloc_stackframe(); struct loadparm_context *lp_ctx; - bRetval = false; - DEBUG(3, ("lp_load_ex: refreshing parameters\n")); bInGlobalSection = true; diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c index 2190d2a0919..62cb0e5f846 100644 --- a/source3/registry/reg_api.c +++ b/source3/registry/reg_api.c @@ -136,7 +136,7 @@ static WERROR regkey_open_onelevel(TALLOC_CTX *mem_ctx, uint32_t access_desired, struct registry_key **pregkey) { - WERROR result = WERR_OK; + WERROR result; struct registry_key *regkey; struct registry_key_handle *key; @@ -955,7 +955,7 @@ static WERROR reg_deletekey_recursive_internal(struct registry_key *parent, const char *path, bool del_key, bool lazy) { - WERROR werr = WERR_OK; + WERROR werr; struct registry_key *key; char *subkey_name = NULL; uint32_t i; diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c index 7749b812c24..c870dc57ed6 100644 --- a/source3/registry/reg_backend_db.c +++ b/source3/registry/reg_backend_db.c @@ -850,20 +850,22 @@ WERROR regdb_init(void) WERROR regdb_open( void ) { - WERROR result = WERR_OK; - char *db_path; + WERROR result; + char *db_path = NULL; int saved_errno; if ( regdb ) { DEBUG(10, ("regdb_open: incrementing refcount (%d->%d)\n", regdb_refcount, regdb_refcount+1)); regdb_refcount++; - return WERR_OK; + result = WERR_OK; + goto done; } db_path = state_path(talloc_tos(), "registry.tdb"); if (db_path == NULL) { - return WERR_NOT_ENOUGH_MEMORY; + result = WERR_NOT_ENOUGH_MEMORY; + goto done; } become_root(); @@ -877,16 +879,17 @@ WERROR regdb_open( void ) result = ntstatus_to_werror(map_nt_error_from_unix(saved_errno)); DEBUG(0,("regdb_open: Failed to open %s! (%s)\n", db_path, strerror(saved_errno))); - TALLOC_FREE(db_path); - return result; + goto done; } - TALLOC_FREE(db_path); regdb_refcount = 1; DEBUG(10, ("regdb_open: registry db opened. refcount reset (%d)\n", regdb_refcount)); - return WERR_OK; + result = WERR_OK; +done: + TALLOC_FREE(db_path); + return result; } /*********************************************************************** @@ -1674,8 +1677,6 @@ static bool regdb_key_exists(struct db_context *db, const char *key) buflen = value.dsize - len; buf = (const char *)value.dptr + len; - len = 0; - for (i = 0; i < num_items; i++) { if (buflen == 0) { break; diff --git a/source4/libcli/ldap/ldap_client.c b/source4/libcli/ldap/ldap_client.c index da84adc7769..a5defbcb4e3 100644 --- a/source4/libcli/ldap/ldap_client.c +++ b/source4/libcli/ldap/ldap_client.c @@ -1020,7 +1020,7 @@ _PUBLIC_ NTSTATUS ldap_result_one(struct ldap_request *req, struct ldap_message if (!NT_STATUS_IS_OK(status)) { return status; } - if ((*msg)->type != type) { + if ((*msg) != NULL && (*msg)->type != type) { *msg = NULL; return NT_STATUS_UNEXPECTED_NETWORK_ERROR; } diff --git a/source4/libcli/raw/clitree.c b/source4/libcli/raw/clitree.c index b1b6159e750..e6b7c8a7a0c 100644 --- a/source4/libcli/raw/clitree.c +++ b/source4/libcli/raw/clitree.c @@ -135,7 +135,7 @@ NTSTATUS smb_raw_tcon_recv(struct smbcli_request *req, TALLOC_CTX *mem_ctx, p += smbcli_req_pull_string(&req->in.bufinfo, mem_ctx, &parms->tconx.out.dev_type, p, -1, STR_ASCII | STR_TERMINATE); - p += smbcli_req_pull_string(&req->in.bufinfo, mem_ctx, &parms->tconx.out.fs_type, + smbcli_req_pull_string(&req->in.bufinfo, mem_ctx, &parms->tconx.out.fs_type, p, -1, STR_TERMINATE); break; diff --git a/source4/libcli/raw/rawnegotiate.c b/source4/libcli/raw/rawnegotiate.c index cec081c364a..51c6f0f9ecb 100644 --- a/source4/libcli/raw/rawnegotiate.c +++ b/source4/libcli/raw/rawnegotiate.c @@ -154,7 +154,7 @@ NTSTATUS smb_raw_negotiate_recv(struct tevent_req *req) NTSTATUS smb_raw_negotiate(struct smbcli_transport *transport, bool unicode, int minprotocol, int maxprotocol) { - NTSTATUS status = NT_STATUS_INTERNAL_ERROR; + NTSTATUS status; struct tevent_req *subreq = NULL; bool ok; @@ -164,7 +164,8 @@ NTSTATUS smb_raw_negotiate(struct smbcli_transport *transport, bool unicode, minprotocol, maxprotocol); if (subreq == NULL) { - return NT_STATUS_NO_MEMORY; + status = NT_STATUS_NO_MEMORY; + goto failed; } ok = tevent_req_poll(subreq, transport->ev); diff --git a/source4/libcli/smb_composite/fetchfile.c b/source4/libcli/smb_composite/fetchfile.c index dc6f71b452e..30e3a626ce6 100644 --- a/source4/libcli/smb_composite/fetchfile.c +++ b/source4/libcli/smb_composite/fetchfile.c @@ -88,7 +88,7 @@ static NTSTATUS fetchfile_read(struct composite_context *c, static void fetchfile_state_handler(struct composite_context *c) { struct fetchfile_state *state; - NTSTATUS status = NT_STATUS_UNSUCCESSFUL; + NTSTATUS status; state = talloc_get_type(c->private_data, struct fetchfile_state); @@ -101,6 +101,9 @@ static void fetchfile_state_handler(struct composite_context *c) case FETCHFILE_READ: status = fetchfile_read(c, state->io); break; + default: + status = NT_STATUS_UNSUCCESSFUL; + break; } if (!NT_STATUS_IS_OK(status)) { -- Samba Shared Repository