From 75de7c0e87cc5ecea1a7d7e9b0103a8cc2827895 Mon Sep 17 00:00:00 2001 From: Marc VanHeyningen Date: Tue, 5 May 2009 22:07:40 +0000 Subject: s3: zero an uninitialized array Invalid pointers were being dereferenced in lookup_sids causing occasional seg faults. Signed-off-by: Tim Prouty --- source3/passdb/lookup_sid.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source3/passdb/lookup_sid.c b/source3/passdb/lookup_sid.c index b45000e77e..3a03cfe081 100644 --- a/source3/passdb/lookup_sid.c +++ b/source3/passdb/lookup_sid.c @@ -468,12 +468,15 @@ static bool lookup_rids(TALLOC_CTX *mem_ctx, const DOM_SID *domain_sid, sid_string_dbg(domain_sid))); if (num_rids) { - *names = TALLOC_ARRAY(mem_ctx, const char *, num_rids); + *names = TALLOC_ZERO_ARRAY(mem_ctx, const char *, num_rids); *types = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_rids); if ((*names == NULL) || (*types == NULL)) { return false; } + + for (i = 0; i < num_rids; i++) + (*types)[i] = SID_NAME_UNKNOWN; } else { *names = NULL; *types = NULL; -- cgit