diff --git a/qrexec/qrexec-client.c b/qrexec/qrexec-client.c index 38fb57f..7464f80 100644 --- a/qrexec/qrexec-client.c +++ b/qrexec/qrexec-client.c @@ -139,7 +139,7 @@ void handle_daemon_data(int s) { int status; struct client_header hdr; - char buf[MAX_DATA_CHUNK]; + char buf[MAX_DATA_CHUNK], *bufptr=buf; if (!read_all(s, &hdr, sizeof hdr)) { perror("read daemon"); @@ -176,7 +176,7 @@ void handle_daemon_data(int s) write_all(2, buf, hdr.len); break; case MSG_SERVER_TO_CLIENT_EXIT_CODE: - status = *(unsigned int *) buf; + status = *(unsigned int *) bufptr; if (WIFEXITED(status)) do_exit(WEXITSTATUS(status)); else diff --git a/qrexec/qrexec-daemon.c b/qrexec/qrexec-daemon.c index 21c82f0..6f489d7 100644 --- a/qrexec/qrexec-daemon.c +++ b/qrexec/qrexec-daemon.c @@ -384,7 +384,7 @@ void get_packet_data_from_agent_and_pass_to_client(int client_id, struct client_ char buf[sizeof(*hdr) + len]; /* make both the header and data be consecutive in the buffer */ - *(struct client_header *) buf = *hdr; + memcpy(buf, hdr, sizeof(*hdr)); read_all_vchan_ext(buf + sizeof(*hdr), len); if (clients[client_id].state & CLIENT_EXITED) // ignore data for no longer running client