diff options
author | Bernd Schubert <bschubert@ddn.com> | 2025-05-28 15:57:27 +0200 |
---|---|---|
committer | Bernd Schubert <bernd@bsbernd.com> | 2025-08-22 23:07:24 +0200 |
commit | 7e6cdc754ae82706435e8bdd8e98d0f4f6cf9881 (patch) | |
tree | 36d2d421da1b49d19bf0f7953dcda2b86632b692 /lib/fuse_uring.c | |
parent | d52ae4f9d44d7e08375bfacac0bc7cc02ad1b54b (diff) | |
download | libfuse-7e6cdc754ae82706435e8bdd8e98d0f4f6cf9881.tar.gz |
send_reply_uring: Avoid memcpy if src and dest are identical
The application might have just written directly into the payload
to no need to copy it and in fact, using memcpy would be undefined
behavior.
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
Diffstat (limited to 'lib/fuse_uring.c')
-rw-r--r-- | lib/fuse_uring.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/fuse_uring.c b/lib/fuse_uring.c index ee68fab..4c6f0a4 100644 --- a/lib/fuse_uring.c +++ b/lib/fuse_uring.c @@ -233,7 +233,8 @@ int send_reply_uring(fuse_req_t req, int error, const void *arg, size_t argsize) argsize, max_payload_sz); error = -EINVAL; } else if (argsize) { - memcpy(ring_ent->op_payload, arg, argsize); + if (arg != ring_ent->op_payload) + memcpy(ring_ent->op_payload, arg, argsize); } ent_in_out->payload_sz = argsize; |