From f70c56b74769711e358860655bbb5c2329ad005b Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 10 Dec 2012 17:39:03 +0100 Subject: s3-net: Check return value of string_to_sid(). Found by Coverity. Signed-off-by: Andreas Schneider Reviewed-by: Guenther Deschner --- source3/utils/net_rpc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index 57d619e28b..2ccc92876b 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -4682,6 +4682,7 @@ static bool get_user_sids(const char *domain, const char *user, struct security_ for (i = 0; i < num_groups; i++) { gid_t gid = groups[i]; struct dom_sid sid; + bool ok; wbc_status = wbcGidToSid(gid, &wsid); if (!WBC_ERROR_IS_OK(wbc_status)) { @@ -4695,7 +4696,12 @@ static bool get_user_sids(const char *domain, const char *user, struct security_ DEBUG(3, (" %s\n", sid_str)); - string_to_sid(&sid, sid_str); + ok = string_to_sid(&sid, sid_str); + if (!ok) { + DEBUG(1, ("Failed to convert string to SID\n")); + wbcFreeMemory(groups); + return false; + } add_sid_to_token(token, &sid); } wbcFreeMemory(groups); -- cgit