summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Kroeger <andrew@id10ts.net>2009-06-23 07:26:17 -0500
committerAndrew Bartlett <abartlet@samba.org>2009-06-29 13:40:08 +1000
commit994506ae2eb7e8e7eb0463fb87b261eaecb04010 (patch)
tree182908f09c4df38cc9ed7acf14e1a7f05605c485 /source4
parent2d9b51c2a871ede1677dcf8cbf255429de431346 (diff)
downloadsamba-994506ae2eb7e8e7eb0463fb87b261eaecb04010.tar.gz
samba-994506ae2eb7e8e7eb0463fb87b261eaecb04010.tar.bz2
samba-994506ae2eb7e8e7eb0463fb87b261eaecb04010.zip
ldb: Properly handle NULL when copying attr lists.
When copying an attribute list, ensure the list itself is not NULL before attempting to access elements of the list.
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/ldb/common/ldb_msg.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c
index ad53a3d29d..8d0fa313a0 100644
--- a/source4/lib/ldb/common/ldb_msg.c
+++ b/source4/lib/ldb/common/ldb_msg.c
@@ -643,12 +643,12 @@ const char **ldb_attr_list_copy(TALLOC_CTX *mem_ctx, const char * const *attrs)
{
const char **ret;
int i;
- for (i=0;attrs[i];i++) /* noop */ ;
+ for (i=0;attrs && attrs[i];i++) /* noop */ ;
ret = talloc_array(mem_ctx, const char *, i+1);
if (ret == NULL) {
return NULL;
}
- for (i=0;attrs[i];i++) {
+ for (i=0;attrs && attrs[i];i++) {
ret[i] = attrs[i];
}
ret[i] = attrs[i];
@@ -665,7 +665,7 @@ const char **ldb_attr_list_copy_add(TALLOC_CTX *mem_ctx, const char * const *att
const char **ret;
int i;
bool found = false;
- for (i=0;attrs[i];i++) {
+ for (i=0;attrs && attrs[i];i++) {
if (ldb_attr_cmp(attrs[i], new_attr) == 0) {
found = true;
}
@@ -677,7 +677,7 @@ const char **ldb_attr_list_copy_add(TALLOC_CTX *mem_ctx, const char * const *att
if (ret == NULL) {
return NULL;
}
- for (i=0;attrs[i];i++) {
+ for (i=0;attrs && attrs[i];i++) {
ret[i] = attrs[i];
}
ret[i] = new_attr;