diff options
-rw-r--r-- | common/ipc-client.c | 8 | ||||
-rw-r--r-- | sway/ipc-server.c | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/common/ipc-client.c b/common/ipc-client.c index 24a2f9c2..496fd131 100644 --- a/common/ipc-client.c +++ b/common/ipc-client.c | |||
@@ -78,8 +78,8 @@ struct ipc_response *ipc_recv_response(int socketfd) { | |||
78 | } | 78 | } |
79 | 79 | ||
80 | total = 0; | 80 | total = 0; |
81 | response->size = data32[0]; | 81 | memcpy(&response->size, &data32[0], sizeof(data32[0])); |
82 | response->type = data32[1]; | 82 | memcpy(&response->type, &data32[1], sizeof(data32[1])); |
83 | char *payload = malloc(response->size + 1); | 83 | char *payload = malloc(response->size + 1); |
84 | if (!payload) { | 84 | if (!payload) { |
85 | goto error_2; | 85 | goto error_2; |
@@ -112,8 +112,8 @@ char *ipc_single_command(int socketfd, uint32_t type, const char *payload, uint3 | |||
112 | char data[ipc_header_size]; | 112 | char data[ipc_header_size]; |
113 | uint32_t *data32 = (uint32_t *)(data + sizeof(ipc_magic)); | 113 | uint32_t *data32 = (uint32_t *)(data + sizeof(ipc_magic)); |
114 | memcpy(data, ipc_magic, sizeof(ipc_magic)); | 114 | memcpy(data, ipc_magic, sizeof(ipc_magic)); |
115 | data32[0] = *len; | 115 | memcpy(&data32[0], len, sizeof(*len)); |
116 | data32[1] = type; | 116 | memcpy(&data32[1], &type, sizeof(type)); |
117 | 117 | ||
118 | if (write(socketfd, data, ipc_header_size) == -1) { | 118 | if (write(socketfd, data, ipc_header_size) == -1) { |
119 | sway_abort("Unable to send IPC header"); | 119 | sway_abort("Unable to send IPC header"); |
diff --git a/sway/ipc-server.c b/sway/ipc-server.c index ed710be5..fb5be27b 100644 --- a/sway/ipc-server.c +++ b/sway/ipc-server.c | |||
@@ -253,8 +253,8 @@ int ipc_client_handle_readable(int client_fd, uint32_t mask, void *data) { | |||
253 | return 0; | 253 | return 0; |
254 | } | 254 | } |
255 | 255 | ||
256 | client->payload_length = buf32[0]; | 256 | memcpy(&client->payload_length, &buf32[0], sizeof(buf32[0])); |
257 | client->current_command = (enum ipc_command_type)buf32[1]; | 257 | memcpy(&client->current_command, &buf32[1], sizeof(buf32[1])); |
258 | 258 | ||
259 | if (read_available - received >= (long)client->payload_length) { | 259 | if (read_available - received >= (long)client->payload_length) { |
260 | ipc_client_handle_command(client); | 260 | ipc_client_handle_command(client); |
@@ -832,8 +832,8 @@ bool ipc_send_reply(struct ipc_client *client, const char *payload, uint32_t pay | |||
832 | uint32_t *data32 = (uint32_t*)(data + sizeof(ipc_magic)); | 832 | uint32_t *data32 = (uint32_t*)(data + sizeof(ipc_magic)); |
833 | 833 | ||
834 | memcpy(data, ipc_magic, sizeof(ipc_magic)); | 834 | memcpy(data, ipc_magic, sizeof(ipc_magic)); |
835 | data32[0] = payload_length; | 835 | memcpy(&data32[0], &payload_length, sizeof(payload_length)); |
836 | data32[1] = client->current_command; | 836 | memcpy(&data32[1], &client->current_command, sizeof(client->current_command)); |
837 | 837 | ||
838 | while (client->write_buffer_len + ipc_header_size + payload_length >= | 838 | while (client->write_buffer_len + ipc_header_size + payload_length >= |
839 | client->write_buffer_size) { | 839 | client->write_buffer_size) { |