diff options
author | Noel Power <noel.power@suse.com> | 2019-05-22 14:17:48 +0000 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2019-06-04 22:13:07 +0000 |
commit | edbef9e0403482a66243d3aa8752804fa1666e43 (patch) | |
tree | eed8fe0498bc7e8bfa0f5386815d349c22990437 /source3/winbindd | |
parent | 52cf237b1d4a2f1d6f5541f3cdbcced95ff6f5ff (diff) | |
download | samba-edbef9e0403482a66243d3aa8752804fa1666e43.tar.gz |
s3/winbdind: cppcheck: fix nullPointerArithmetic error
Fixes
source3/winbindd/winbindd_cache.c:4386: error: nullPointerArithmetic: Pointer addition with NULL pointer. <--[cppcheck]
source3/winbindd/winbindd_cache.c:4400: error: nullPointerArithmetic: Pointer addition with NULL pointer. <--[cppcheck]
source3/winbindd/winbindd_cache.c:1569:24: warning: Dereference of null pointer <--[clang]
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source3/winbindd')
-rw-r--r-- | source3/winbindd/winbindd_cache.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c index abdfd11dc53..394b0c774a9 100644 --- a/source3/winbindd/winbindd_cache.c +++ b/source3/winbindd/winbindd_cache.c @@ -4383,7 +4383,8 @@ static int pack_tdc_domains( struct winbindd_tdc_domain *domains, len = 0; /* Store the number of array items first */ - len += tdb_pack( buffer+len, buflen-len, "d", + len += tdb_pack( buffer ? buffer+len : NULL, + buffer ? buflen-len : 0, "d", num_domains ); /* now pack each domain trust record */ @@ -4397,7 +4398,8 @@ static int pack_tdc_domains( struct winbindd_tdc_domain *domains, domains[i].dns_name ? domains[i].dns_name : "UNKNOWN" )); } - len += tdb_pack( buffer+len, buflen-len, "fffddd", + len += tdb_pack( buffer ? buffer+len : NULL, + buffer ? buflen-len : 0, "fffddd", domains[i].domain_name, domains[i].dns_name ? domains[i].dns_name : "", dom_sid_str_buf(&domains[i].sid, &tmp), |