[SCM] Samba Shared Repository - branch master updated
Noel Power
npower at samba.org
Tue Jun 11 13:32:02 UTC 2019
The branch, master has been updated
via 49e2d369186 lib/tdb/common: clang: Fix 'Value stored to 'last_ptr' is never read'
via 0152925879d librpc/ndr: clang: Fix Assigned value is garbage or undefined warning
via e104c01846f lib/util: clang: Fix dereference of a null pointer warning
via acd65542069 lib/util: clang: Fix a dereference of a null pointer warning(s)
via add47e288bc lib/util/charset: clang: Fix Value stored to 'reason' is never read warning
via c8293d84597 lib/util: clang: Fix 'Null pointer passed as an argument...' warning
via f7b816e2b7c DLIST_REMOVE: clang: Fix dereference of a null pointer warning
via 8f422ada8c4 lib/tevent: clang:
via 1c6db152bf1 s4/torture/rpc: cppcheck: Fix ctunullpointer error
from 7cc9e3fe24d s3/vfs_glusterfs_fuse: Avoid using NAME_MAX directly
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 49e2d36918673e7922e4c983809ad1481db63f96
Author: Noel Power <noel.power at suse.com>
Date: Mon May 27 15:47:54 2019 +0000
lib/tdb/common: clang: Fix 'Value stored to 'last_ptr' is never read'
Fixes
lib/tdb/common/freelistcheck.c:96:3: warning: Value stored to 'last_ptr' is never read <--[clang]
last_ptr = rec_ptr;
^ ~~~~~~~
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer gary at catalyst.net.nz
Autobuild-User(master): Noel Power <npower at samba.org>
Autobuild-Date(master): Tue Jun 11 13:31:01 UTC 2019 on sn-devel-184
commit 0152925879d68524e69ed5f02b323fe1bd7f706a
Author: Noel Power <noel.power at suse.com>
Date: Fri May 24 14:16:40 2019 +0000
librpc/ndr: clang: Fix Assigned value is garbage or undefined warning
Fixes:
librpc/ndr/ndr_basic.c:170:5: warning: Assigned value is garbage or undefined <--[clang]
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer gary at catalyst.net.nz
commit e104c01846f6b8bcfb4a3efb269b8b357d17eea6
Author: Noel Power <noel.power at suse.com>
Date: Fri May 24 14:08:58 2019 +0000
lib/util: clang: Fix dereference of a null pointer warning
Fixes:
lib/util/rbtree.c:170:8: warning: Access to field 'rb_parent_color' results in a dereference of a null pointer (loaded from variable 'other') <--[clang]
We could avoid accessing the NULL pointer but previously the code would
have crashed here. Given this is a rbtree probably better to preserve the
fatal nature of encountering a NULL pointer here while satisfying the static
checker.
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer gary at catalyst.net.nz
commit acd65542069457cf24dd64d5c6625e88cb7242fb
Author: Noel Power <noel.power at suse.com>
Date: Fri May 24 14:03:37 2019 +0000
lib/util: clang: Fix a dereference of a null pointer warning(s)
Fixes:
lib/util/ms_fnmatch.c:75:8: warning: Access to field 'predot' results in a dereference of a null pointer (loaded from variable 'max_n') <--[clang]
if (max_n->predot && max_n->predot <= n) {
^
lib/util/ms_fnmatch.c:91:8: warning: Access to field 'predot' results in a dereference of a null pointer (loaded from variable 'max_n') <--[clang]
if (max_n->predot && max_n->predot <= n) {
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer gary at catalyst.net.nz
commit add47e288bc80c1bf45765d1588a9fa5998ea677
Author: Noel Power <noel.power at suse.com>
Date: Fri May 24 13:37:00 2019 +0000
lib/util/charset: clang: Fix Value stored to 'reason' is never read warning
Fixes:
lib/util/charset/convert_string.c:301:5: warning: Value stored to 'reason' is never read <--[clang]
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer gary at catalyst.net.nz
commit c8293d8459711e7f67cbd10f508868e463cbccac
Author: Noel Power <noel.power at suse.com>
Date: Fri May 24 13:32:09 2019 +0000
lib/util: clang: Fix 'Null pointer passed as an argument...' warning
Fixes:
lib/util/debug.c:705:7: warning: Null pointer passed as an argument to a 'nonnull' parameter <--[clang]
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer gary at catalyst.net.nz
commit f7b816e2b7c2e67088e0236b0cebae1d0baa0e21
Author: Noel Power <noel.power at suse.com>
Date: Fri May 24 13:07:46 2019 +0000
DLIST_REMOVE: clang: Fix dereference of a null pointer warning
Fixes:
lib/tevent/tevent_wrapper.c:295:3: warning: Access to field 'next' results in a dereference of a null pointer (loaded from field 'prev') <--[clang]
Additionally fix similar instance of the same macro
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer gary at catalyst.net.nz
commit 8f422ada8c4d4efc0a9122479b4719c0086281d7
Author: Noel Power <noel.power at suse.com>
Date: Fri May 24 13:01:30 2019 +0000
lib/tevent: clang:
Fixes:
lib/tevent/tevent_wrapper.c:213:6: warning: Access to field 'destroyed' results in a dereference of a null pointer (loaded from variable 'glue') <--[clang]
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer gary at catalyst.net.nz
commit 1c6db152bf1b0de205017dcfae358ba362545de1
Author: Noel Power <noel.power at suse.com>
Date: Fri May 24 11:03:09 2019 +0000
s4/torture/rpc: cppcheck: Fix ctunullpointer error
Fixes
source4/torture/rpc/netlogon.c:307: error: ctunullpointer: Null pointer dereference: p <--[cppcheck]
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer gary at catalyst.net.nz
-----------------------------------------------------------------------
Summary of changes:
lib/ldb/include/dlinklist.h | 2 +-
lib/tdb/common/freelistcheck.c | 1 -
lib/tevent/tevent_util.h | 2 +-
lib/tevent/tevent_wrapper.c | 2 ++
lib/util/charset/convert_string.c | 8 ++++----
lib/util/debug.c | 10 +++++++---
lib/util/dlinklist.h | 2 +-
lib/util/ms_fnmatch.c | 26 ++++++++++++++++++++------
lib/util/rbtree.c | 7 +++++++
librpc/ndr/ndr_basic.c | 17 ++++++++++-------
source4/torture/rpc/netlogon.c | 8 +++++++-
11 files changed, 60 insertions(+), 25 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/ldb/include/dlinklist.h b/lib/ldb/include/dlinklist.h
index ef01aec9f1c..822a8266e04 100644
--- a/lib/ldb/include/dlinklist.h
+++ b/lib/ldb/include/dlinklist.h
@@ -86,7 +86,7 @@ do { \
if ((p) == (list)) { \
if ((p)->next) (p)->next->prev = (p)->prev; \
(list) = (p)->next; \
- } else if ((list) && (p) == (list)->prev) { \
+ } else if ((p)->prev && (list) && (p) == (list)->prev) { \
(p)->prev->next = NULL; \
(list)->prev = (p)->prev; \
} else { \
diff --git a/lib/tdb/common/freelistcheck.c b/lib/tdb/common/freelistcheck.c
index c6bfeaa41bf..2f1e6eb67ca 100644
--- a/lib/tdb/common/freelistcheck.c
+++ b/lib/tdb/common/freelistcheck.c
@@ -93,7 +93,6 @@ _PUBLIC_ int tdb_validate_freelist(struct tdb_context *tdb, int *pnum_entries)
}
/* move to the next record */
- last_ptr = rec_ptr;
rec_ptr = rec.next;
*pnum_entries += 1;
}
diff --git a/lib/tevent/tevent_util.h b/lib/tevent/tevent_util.h
index e2cdbb8d385..eef4a00f98b 100644
--- a/lib/tevent/tevent_util.h
+++ b/lib/tevent/tevent_util.h
@@ -82,7 +82,7 @@ do { \
if ((p) == (list)) { \
if ((p)->next) (p)->next->prev = (p)->prev; \
(list) = (p)->next; \
- } else if ((list) && (p) == (list)->prev) { \
+ } else if ((p)->prev && (list) && (p) == (list)->prev) { \
(p)->prev->next = NULL; \
(list)->prev = (p)->prev; \
} else { \
diff --git a/lib/tevent/tevent_wrapper.c b/lib/tevent/tevent_wrapper.c
index deeb64ec177..a0e915f6753 100644
--- a/lib/tevent/tevent_wrapper.c
+++ b/lib/tevent/tevent_wrapper.c
@@ -208,6 +208,8 @@ static int tevent_wrapper_context_destructor(struct tevent_context *wrap_ev)
if (glue == NULL) {
tevent_abort(wrap_ev,
"tevent_wrapper_context_destructor() active on main");
+ /* static checker support, return below is never reached */
+ return -1;
}
if (glue->destroyed && glue->busy) {
diff --git a/lib/util/charset/convert_string.c b/lib/util/charset/convert_string.c
index d8fb9bdd477..d274e305a0c 100644
--- a/lib/util/charset/convert_string.c
+++ b/lib/util/charset/convert_string.c
@@ -300,13 +300,13 @@ bool convert_string_handle(struct smb_iconv_handle *ic,
{
reason="No more room";
if (from == CH_UNIX) {
- DEBUG(3,("E2BIG: convert_string(%s,%s): srclen=%u destlen=%u - '%s'\n",
+ DEBUG(3,("E2BIG: convert_string(%s,%s): srclen=%u destlen=%u - '%s' error: %s\n",
charset_name(ic, from), charset_name(ic, to),
- (unsigned int)srclen, (unsigned int)destlen, (const char *)src));
+ (unsigned int)srclen, (unsigned int)destlen, (const char *)src, reason));
} else {
- DEBUG(3,("E2BIG: convert_string(%s,%s): srclen=%u destlen=%u\n",
+ DEBUG(3,("E2BIG: convert_string(%s,%s): srclen=%u destlen=%u error: %s\n",
charset_name(ic, from), charset_name(ic, to),
- (unsigned int)srclen, (unsigned int)destlen));
+ (unsigned int)srclen, (unsigned int)destlen, reason));
}
break;
}
diff --git a/lib/util/debug.c b/lib/util/debug.c
index d2fbab12414..c42022ec9bb 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -699,11 +699,15 @@ static int debug_lookup_classname_int(const char* classname)
{
size_t i;
- if (!classname) return -1;
+ if (classname == NULL) {
+ return -1;
+ }
for (i=0; i < debug_num_classes; i++) {
- if (strcmp(classname, classname_table[i])==0)
+ char *entry = classname_table[i];
+ if (entry != NULL && strcmp(classname, entry)==0) {
return i;
+ }
}
return -1;
}
@@ -780,7 +784,7 @@ static int debug_lookup_classname(const char *classname)
{
int ndx;
- if (!classname || !*classname)
+ if (classname == NULL || !*classname)
return -1;
ndx = debug_lookup_classname_int(classname);
diff --git a/lib/util/dlinklist.h b/lib/util/dlinklist.h
index 8a1b84d4429..4003b233761 100644
--- a/lib/util/dlinklist.h
+++ b/lib/util/dlinklist.h
@@ -82,7 +82,7 @@ do { \
if ((p) == (list)) { \
if ((p)->next) (p)->next->prev = (p)->prev; \
(list) = (p)->next; \
- } else if ((list) && (p) == (list)->prev) { \
+ } else if ((p)->prev && (list) && (p) == (list)->prev) { \
(p)->prev->next = NULL; \
(list)->prev = (p)->prev; \
} else { \
diff --git a/lib/util/ms_fnmatch.c b/lib/util/ms_fnmatch.c
index 636ac399f66..5e05312f25a 100644
--- a/lib/util/ms_fnmatch.c
+++ b/lib/util/ms_fnmatch.c
@@ -72,7 +72,8 @@ static int ms_fnmatch_core(const char *p, const char *n,
switch (c) {
case '*':
/* a '*' matches zero or more characters of any type */
- if (max_n->predot && max_n->predot <= n) {
+ if (max_n != NULL && max_n->predot &&
+ max_n->predot <= n) {
return null_match(p);
}
for (i=0; n[i]; i += size_n) {
@@ -81,17 +82,22 @@ static int ms_fnmatch_core(const char *p, const char *n,
return 0;
}
}
- if (!max_n->predot || max_n->predot > n) max_n->predot = n;
+ if (max_n != NULL && (!max_n->predot ||
+ max_n->predot > n)) {
+ max_n->predot = n;
+ }
return null_match(p);
case '<':
/* a '<' matches zero or more characters of
any type, but stops matching at the last
'.' in the string. */
- if (max_n->predot && max_n->predot <= n) {
+ if (max_n != NULL && max_n->predot &&
+ max_n->predot <= n) {
return null_match(p);
}
- if (max_n->postdot && max_n->postdot <= n && n <= ldot) {
+ if (max_n != NULL && max_n->postdot &&
+ max_n->postdot <= n && n <= ldot) {
return -1;
}
for (i=0; n[i]; i += size_n) {
@@ -99,11 +105,19 @@ static int ms_fnmatch_core(const char *p, const char *n,
if (ms_fnmatch_core(p, n+i, max_n+1, ldot, is_case_sensitive) == 0) return 0;
if (n+i == ldot) {
if (ms_fnmatch_core(p, n+i+size_n, max_n+1, ldot, is_case_sensitive) == 0) return 0;
- if (!max_n->postdot || max_n->postdot > n) max_n->postdot = n;
+ if (max_n != NULL) {
+ if (!max_n->postdot ||
+ max_n->postdot > n) {
+ max_n->postdot = n;
+ }
+ }
return -1;
}
}
- if (!max_n->predot || max_n->predot > n) max_n->predot = n;
+ if (max_n != NULL && (!max_n->predot ||
+ max_n->predot > n)) {
+ max_n->predot = n;
+ }
return null_match(p);
case '?':
diff --git a/lib/util/rbtree.c b/lib/util/rbtree.c
index b7add66234f..aa663f49f02 100644
--- a/lib/util/rbtree.c
+++ b/lib/util/rbtree.c
@@ -22,6 +22,7 @@
#include "replace.h"
#include "rbtree.h"
+#include "fault.h"
#define RB_RED 0
#define RB_BLACK 1
@@ -167,6 +168,12 @@ static void __rb_erase_color(struct rb_node *node, struct rb_node *parent,
if (parent->rb_left == node)
{
other = parent->rb_right;
+ if (other == NULL) {
+ /* we should never get here */
+ smb_panic("corrupted rb tree");
+ /* satisfy static checkers */
+ return;
+ }
if (rb_is_red(other))
{
rb_set_black(other);
diff --git a/librpc/ndr/ndr_basic.c b/librpc/ndr/ndr_basic.c
index 3a5189570c5..0bce1322265 100644
--- a/librpc/ndr/ndr_basic.c
+++ b/librpc/ndr/ndr_basic.c
@@ -160,13 +160,16 @@ _PUBLIC_ enum ndr_err_code ndr_pull_uint32(struct ndr_pull *ndr, int ndr_flags,
*/
_PUBLIC_ enum ndr_err_code ndr_pull_uint3264(struct ndr_pull *ndr, int ndr_flags, uint32_t *v)
{
- uint64_t v64;
+ uint64_t v64 = 0;
enum ndr_err_code err;
NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
if (likely(!(ndr->flags & LIBNDR_FLAG_NDR64))) {
return ndr_pull_uint32(ndr, ndr_flags, v);
}
err = ndr_pull_hyper(ndr, ndr_flags, &v64);
+ if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
+ return err;
+ }
*v = (uint32_t)v64;
if (unlikely(v64 != *v)) {
DEBUG(0,(__location__ ": non-zero upper 32 bits 0x%016llx\n",
@@ -891,7 +894,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_uid_t(struct ndr_push *ndr, int ndr_flags, u
*/
_PUBLIC_ enum ndr_err_code ndr_pull_uid_t(struct ndr_pull *ndr, int ndr_flags, uid_t *u)
{
- uint64_t uu;
+ uint64_t uu = 0;
NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, &uu));
*u = (uid_t)uu;
if (unlikely(uu != *u)) {
@@ -917,7 +920,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_gid_t(struct ndr_push *ndr, int ndr_flags, g
*/
_PUBLIC_ enum ndr_err_code ndr_pull_gid_t(struct ndr_pull *ndr, int ndr_flags, gid_t *g)
{
- uint64_t gg;
+ uint64_t gg = 0;
NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, &gg));
*g = (gid_t)gg;
if (unlikely(gg != *g)) {
@@ -1450,8 +1453,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull_timespec(struct ndr_pull *ndr,
int ndr_flags,
struct timespec *t)
{
- uint64_t secs;
- uint32_t nsecs;
+ uint64_t secs = 0;
+ uint32_t nsecs = 0;
NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, &secs));
NDR_CHECK(ndr_pull_uint32(ndr, ndr_flags, &nsecs));
@@ -1481,8 +1484,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull_timeval(struct ndr_pull *ndr,
int ndr_flags,
struct timeval *t)
{
- uint64_t secs;
- uint32_t usecs;
+ uint64_t secs = 0;
+ uint32_t usecs = 0;
NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, &secs));
NDR_CHECK(ndr_pull_uint32(ndr, ndr_flags, &usecs));
diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c
index 52c443e39f3..94fe4020fa9 100644
--- a/source4/torture/rpc/netlogon.c
+++ b/source4/torture/rpc/netlogon.c
@@ -304,7 +304,13 @@ bool test_SetupCredentials3(struct dcerpc_pipe *p, struct torture_context *tctx,
uint32_t rid;
const char *machine_name;
const char *plain_pass;
- struct dcerpc_binding_handle *b = p->binding_handle;
+ struct dcerpc_binding_handle *b = NULL;
+
+ if (p == NULL) {
+ return false;
+ }
+
+ b = p->binding_handle;
machine_name = cli_credentials_get_workstation(machine_credentials);
torture_assert(tctx, machine_name != NULL, "machine_name");
--
Samba Shared Repository
More information about the samba-cvs
mailing list