aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Serbinenko <phcoder@gmail.com>2024-11-20 21:16:16 +0300
committerBernd Schubert <bernd.schubert@fastmail.fm>2024-11-21 21:42:18 +0100
commit66a03d4e4b0956d02bd820e591f64f49917f22ae (patch)
tree5fe411743fec9084b5600ac9d8a2e21c682ef777
parent0e0f43b79b9b3e746f2d4c6b96294b8a954c6708 (diff)
downloadlibfuse-66a03d4e4b0956d02bd820e591f64f49917f22ae.tar.gz
Fix alignment of allocation in fuse_reply_create
When allocating as an array of char only alignment of 1 is guaranteed but the structure needs an alignment of 8. Specify alignment explicitly
-rw-r--r--lib/fuse_lowlevel.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
index aa1de87..9cc96e9 100644
--- a/lib/fuse_lowlevel.c
+++ b/lib/fuse_lowlevel.c
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
+#include <stdalign.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
@@ -446,7 +447,7 @@ int fuse_reply_entry(fuse_req_t req, const struct fuse_entry_param *e)
int fuse_reply_create(fuse_req_t req, const struct fuse_entry_param *e,
const struct fuse_file_info *f)
{
- char buf[sizeof(struct fuse_entry_out) + sizeof(struct fuse_open_out)];
+ alignas(uint64_t) char buf[sizeof(struct fuse_entry_out) + sizeof(struct fuse_open_out)];
size_t entrysize = req->se->conn.proto_minor < 9 ?
FUSE_COMPAT_ENTRY_OUT_SIZE : sizeof(struct fuse_entry_out);
struct fuse_entry_out *earg = (struct fuse_entry_out *) buf;