From ab14918ea406eed2ed79c39dea7b855e4ecbac74 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 14 Dec 2012 16:54:55 +0100 Subject: [PATCH] s3-idmap: Check return value of string_to_sid(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Found by Coverity. Signed-off-by: Andreas Schneider Reviewed-by: Günther Deschner Reviewed-by: Christian Ambach --- source3/winbindd/idmap_autorid.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c index 621cae98ef7..b7b168970bb 100644 --- a/source3/winbindd/idmap_autorid.c +++ b/source3/winbindd/idmap_autorid.c @@ -248,6 +248,7 @@ static NTSTATUS idmap_autorid_id_to_sid(struct autorid_global_config *cfg, char *keystr; struct dom_sid sid; NTSTATUS status; + bool ok; /* can this be one of our ids? */ if (map->xid.id < cfg->minvalue) { @@ -297,8 +298,12 @@ static NTSTATUS idmap_autorid_id_to_sid(struct autorid_global_config *cfg, return idmap_autorid_map_id_to_sid(dom, map); } - string_to_sid(&sid, (const char *)data.dptr); + ok = string_to_sid(&sid, (const char *)data.dptr); TALLOC_FREE(data.dptr); + if (!ok) { + map->status = ID_UNKNOWN; + return NT_STATUS_OK; + } sid_compose(map->sid, &sid, (map->xid.id - cfg->minvalue - -- 2.11.4.GIT