Fix some potential aliasing issues
This commit is contained in:
parent
2b95581928
commit
36c8885ff2
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user