diff options
author | Volker Lendecke <vl@samba.org> | 2018-08-07 22:49:16 +0200 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2018-08-23 10:38:27 +0200 |
commit | 2e285845ea03c5505092b8de5f6097e5845b25ec (patch) | |
tree | ba7f88dbe345f4a164c8ef8d9b31950341f4eca2 | |
parent | c45fb4b658890f03a045519f95df160f27f96183 (diff) | |
download | samba-2e285845ea03c5505092b8de5f6097e5845b25ec.tar.gz |
smbd: Fix CID 1438246 Unchecked return value
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13553
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r-- | source3/smbd/nttrans.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 810f8b92b43..bad904b9eb8 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -2317,6 +2317,7 @@ static enum ndr_err_code fill_qtlist_from_sids(TALLOC_CTX *mem_ctx, for (i = 0; i < elems; i++) { SMB_NTQUOTA_STRUCT qt; SMB_NTQUOTA_LIST *list_item; + bool ok; if (!NT_STATUS_IS_OK(vfs_get_ntquota(fsp, SMB_USER_QUOTA_TYPE, @@ -2333,7 +2334,15 @@ static enum ndr_err_code fill_qtlist_from_sids(TALLOC_CTX *mem_ctx, return NDR_ERR_ALLOC; } - sid_to_uid(&sids[i], &list_item->uid); + ok = sid_to_uid(&sids[i], &list_item->uid); + if (!ok) { + char buf[DOM_SID_STR_BUFLEN]; + dom_sid_string_buf(&sids[i], buf, sizeof(buf)); + DBG_WARNING("Could not convert SID %s to uid\n", buf); + /* No idea what to return here... */ + return NDR_ERR_INVALID_POINTER; + } + list_item->quotas = talloc_zero(list_item, SMB_NTQUOTA_STRUCT); if (list_item->quotas == NULL) { DBG_ERR("failed to allocate\n"); |