mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Zero-initialise stack-allocated objects in hstox driver.
These potentially cause uninitialised reads on some platforms or msgpack library versions.
This commit is contained in:
parent
79d8a22b48
commit
2e33ab26df
|
@ -80,7 +80,7 @@ static int write_sample_input(msgpack_object req)
|
|||
|
||||
check_return(E_WRITE, ftruncate(fd, 0));
|
||||
|
||||
msgpack_sbuffer sbuf __attribute__((__cleanup__(msgpack_sbuffer_destroy)));
|
||||
msgpack_sbuffer sbuf __attribute__((__cleanup__(msgpack_sbuffer_destroy))) = {0};
|
||||
msgpack_sbuffer_init(&sbuf);
|
||||
|
||||
msgpack_packer pk;
|
||||
|
@ -101,7 +101,7 @@ static int handle_request(struct settings cfg, int write_fd, msgpack_object req)
|
|||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
msgpack_sbuffer sbuf __attribute__((__cleanup__(msgpack_sbuffer_destroy))); /* buffer */
|
||||
msgpack_sbuffer sbuf __attribute__((__cleanup__(msgpack_sbuffer_destroy))) = {0}; /* buffer */
|
||||
msgpack_sbuffer_init(&sbuf); /* initialize buffer */
|
||||
|
||||
msgpack_packer pk; /* packer */
|
||||
|
@ -186,7 +186,7 @@ int communicate(struct settings cfg, int read_fd, int write_fd)
|
|||
memcpy(msgpack_unpacker_buffer(&unp), buf, size);
|
||||
msgpack_unpacker_buffer_consumed(&unp, size);
|
||||
|
||||
msgpack_unpacked req __attribute__((__cleanup__(msgpack_unpacked_destroy)));
|
||||
msgpack_unpacked req __attribute__((__cleanup__(msgpack_unpacked_destroy))) = {0};
|
||||
msgpack_unpacked_init(&req);
|
||||
|
||||
switch (msgpack_unpacker_next(&unp, &req)) {
|
||||
|
@ -225,7 +225,7 @@ static int run_tests(struct settings cfg, int port)
|
|||
1
|
||||
}, sizeof(int)));
|
||||
|
||||
struct sockaddr_in servaddr;
|
||||
struct sockaddr_in servaddr = {0};
|
||||
servaddr.sin_family = AF_INET;
|
||||
servaddr.sin_addr.s_addr = htons(INADDR_ANY);
|
||||
servaddr.sin_port = htons(port);
|
||||
|
|
Loading…
Reference in New Issue
Block a user