[PATCH] Add missing OOM check to quota code
Andreas Schneider
asn at samba.org
Tue May 14 15:14:36 UTC 2019
Hi,
just a small cleanup patch.
Review much appreciated.
Thanks,
Andreas
--
Andreas Schneider asn at samba.org
Samba Team www.samba.org
GPG-ID: 8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D
-------------- next part --------------
>From 3d1b230e84f53e1a60be6ef48d5921f75b440a01 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 14 May 2019 12:48:14 +0200
Subject: [PATCH] s3:libsmb: Add missing OOM check in fill_quota_buffer()
Found by covscan (csbuild).
Signed-off-by: Andreas Schneider <asn at samba.org>
---
source3/libsmb/cliquota.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/source3/libsmb/cliquota.c b/source3/libsmb/cliquota.c
index 52f98eb9e8f..17655e095f3 100644
--- a/source3/libsmb/cliquota.c
+++ b/source3/libsmb/cliquota.c
@@ -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;
--
2.21.0
More information about the samba-technical
mailing list