]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:libsmb: Add missing OOM check in fill_quota_buffer()
authorAndreas Schneider <asn@samba.org>
Tue, 14 May 2019 10:48:14 +0000 (12:48 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 15 May 2019 00:45:58 +0000 (00:45 +0000)
Found by covscan (csbuild).

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Noel Power <nopower@suse.com>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed May 15 00:45:58 UTC 2019 on sn-devel-184

source3/libsmb/cliquota.c

index 52f98eb9e8f8fcf7c8ee3722577f4269bd29853a..17655e095f31a4bfe309cdaaafdf15ba46a52b61 100644 (file)
@@ -587,13 +587,19 @@ NTSTATUS fill_quota_buffer(TALLOC_CTX *mem_ctx,
                              SMB_NTQUOTA_LIST **end_ptr)
 {
        int ndr_flags = NDR_SCALARS | NDR_BUFFERS;
-       struct ndr_push *qndr = ndr_push_init_ctx(mem_ctx);
+       struct ndr_push *qndr = NULL;
        uint32_t start_offset = 0;
        uint32_t padding = 0;
        if (qlist == NULL) {
                /* We must push at least one. */
                return NT_STATUS_NO_MORE_ENTRIES;
        }
+
+       qndr = ndr_push_init_ctx(mem_ctx);
+       if (qndr == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
        for (;qlist != NULL; qlist = qlist->next) {
                struct file_quota_information info = {0};
                enum ndr_err_code err;