summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormisku <miskuu@gmail.com>2019-07-31 13:12:24 +0200
committerPavel Shilovsky <pshilov@microsoft.com>2019-08-07 14:52:26 -0700
commit5a468f3dcbea4bfbc380a3f86466b8e33bc40570 (patch)
tree81061d56915eb0c97d8306f5583d1ec4b25abebd
parentcb3dc2fe88f6179011acbafaaed025c5bdc96131 (diff)
downloadcifs-utils-5a468f3dcbea4bfbc380a3f86466b8e33bc40570.tar.gz
cifs-utils-5a468f3dcbea4bfbc380a3f86466b8e33bc40570.tar.bz2
cifs-utils-5a468f3dcbea4bfbc380a3f86466b8e33bc40570.zip
Zero fill the allocated memory for new `struct cifs_ntsd`
Fixes a bug where `sacloffset` may not be set at all later on and therefore it can contain the original memory contents == trash.
-rw-r--r--setcifsacl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/setcifsacl.c b/setcifsacl.c
index da1d742..f3d0189 100644
--- a/setcifsacl.c
+++ b/setcifsacl.c
@@ -206,7 +206,7 @@ alloc_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd **npntsd,
acessize = aces * sizeof(struct cifs_ace);
bufsize = size + acessize;
- *npntsd = malloc(bufsize);
+ *npntsd = calloc(1, bufsize);
if (!*npntsd) {
printf("%s: Memory allocation failure", __func__);
return errno;