summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2013-08-18 19:37:56 +0000
committerKarolin Seeger <kseeger@samba.org>2014-07-15 12:46:13 +0200
commit656e363578971189d3350b51e7e669ec58207cb0 (patch)
tree5631d81a2760a577f20b3cbf31b5b3a51134040f
parenta678cd4450153129184c83ae49a92d4f26d4baf7 (diff)
downloadsamba-656e363578971189d3350b51e7e669ec58207cb0.tar.gz
samdb: Fix CID 1034910 Dereference before null check
strncmp("tdb://", secrets_ldb, 6) dereferences secrets_ldb. Check for NULL before that. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> (cherry picked from commit 35330aa2c8b255d74e94bc9dd742e621953c21f9)
-rw-r--r--source4/dsdb/samdb/ldb_modules/secrets_tdb_sync.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/secrets_tdb_sync.c b/source4/dsdb/samdb/ldb_modules/secrets_tdb_sync.c
index e3d8485c611..284aa1b6e2d 100644
--- a/source4/dsdb/samdb/ldb_modules/secrets_tdb_sync.c
+++ b/source4/dsdb/samdb/ldb_modules/secrets_tdb_sync.c
@@ -489,12 +489,12 @@ static int secrets_tdb_sync_init(struct ldb_module *module)
ldb_module_set_private(module, data);
secrets_ldb = (const char *)ldb_get_opaque(ldb, "ldb_url");
- if (strncmp("tdb://", secrets_ldb, 6) == 0) {
- secrets_ldb += 6;
- }
if (!secrets_ldb) {
return ldb_operr(ldb);
}
+ if (strncmp("tdb://", secrets_ldb, 6) == 0) {
+ secrets_ldb += 6;
+ }
private_dir = talloc_strdup(data, secrets_ldb);
p = strrchr(private_dir, '/');
if (p) {