diff --git a/fs/rpmsgfs/rpmsgfs_client.c b/fs/rpmsgfs/rpmsgfs_client.c index a2cba3a506..29a1dd02da 100644 --- a/fs/rpmsgfs/rpmsgfs_client.c +++ b/fs/rpmsgfs/rpmsgfs_client.c @@ -727,11 +727,13 @@ int rpmsgfs_client_rename(FAR void *handle, FAR const char *oldpath, size_t len; size_t oldlen; size_t newlen; + size_t alignlen; uint32_t space; - oldlen = strlen(oldpath) + 1; - newlen = strlen(newpath) + 1; - len = sizeof(*msg) + oldlen + newlen; + oldlen = strlen(oldpath) + 1; + alignlen = (oldlen + 0x7) & ~0x7; + newlen = strlen(newpath) + 1; + len = sizeof(*msg) + alignlen + newlen; msg = rpmsg_get_tx_payload_buffer(&priv->ept, &space, true); if (!msg) @@ -742,7 +744,7 @@ int rpmsgfs_client_rename(FAR void *handle, FAR const char *oldpath, DEBUGASSERT(len <= space); memcpy(msg->pathname, oldpath, oldlen); - memcpy(msg->pathname + oldlen, newpath, newlen); + memcpy(msg->pathname + alignlen, newpath, newlen); return rpmsgfs_send_recv(priv, RPMSGFS_RENAME, false, (struct rpmsgfs_header_s *)msg, len, NULL);