1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

samdb: Fix CID 1034910 Dereference before null check

strncmp("tdb://", sam_name, 6) dereferences sam_name. Check for
NULL before that.

Signed-off-by: Volker Lendecke <vl@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Volker Lendecke 2013-08-18 19:37:56 +00:00 committed by Andrew Bartlett
parent 8c4e6f0cba
commit 6417d9e035

View File

@ -199,13 +199,13 @@ static int partition_metadata_open(struct ldb_module *module, bool create)
} }
sam_name = (const char *)ldb_get_opaque(ldb, "ldb_url"); sam_name = (const char *)ldb_get_opaque(ldb, "ldb_url");
if (strncmp("tdb://", sam_name, 6) == 0) {
sam_name += 6;
}
if (!sam_name) { if (!sam_name) {
talloc_free(tmp_ctx); talloc_free(tmp_ctx);
return ldb_operr(ldb); return ldb_operr(ldb);
} }
if (strncmp("tdb://", sam_name, 6) == 0) {
sam_name += 6;
}
filename = talloc_asprintf(tmp_ctx, "%s.d/metadata.tdb", sam_name); filename = talloc_asprintf(tmp_ctx, "%s.d/metadata.tdb", sam_name);
if (!filename) { if (!filename) {
talloc_free(tmp_ctx); talloc_free(tmp_ctx);