sway/sway
Tobias Stoeckmann edcdb5552d common: handle invalid IPC messages
The size of IPC data is stored in an unsigned 32 bit data type within
the IPC message header. In order to terminate the received data with a
nul byte, one additional byte is allocated.

It is not checked if the transmitted size is 2^32 - 1. Adding one more
byte would overflow and lead to 0 byte allocation.

On 64 bit systems, the recv call with 2^32 - 1 does not fail instantly
but reads data from the server into unallocated memory.

Prevent override of unallocated memory by aborting communication.

Proof of Concept Python server (use 64 bit address sanitized client):
```
import os
import socket

os.remove('/tmp/sway-poc.socket')
server = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
server.bind('/tmp/sway-poc.socket')
server.listen(1)
print('waiting for client')
(client, address) = server.accept()
client.send(b'\x69\x33\x2D\x69\x70\x63\xFF\xFF\xFF\xFF\x00\x00\x00\x00\xFF\xFF\xFF\xFF\xFF')
input('sent reply, press enter')
client.close()
```
2021-05-07 21:10:03 +02:00
..
commands commands/exec_always: log error on execlp failure 2021-04-22 23:12:49 +02:00
config output: Reconfigure xcursor when applying output config 2021-02-24 20:54:48 +01:00
desktop xdg-shell: ignore unecessary fullscreen request ouput hints 2021-04-26 13:14:24 -07:00
input Implement input method keyboard grab 2021-03-12 12:18:08 +01:00
tree view: handle case where map_ws is NULL 2021-04-29 09:06:05 +02:00
commands.c Fix for_window criteria and mouse button bindings 2021-02-25 09:48:39 -05:00
config.c config: allow whitespaces in config path 2021-03-25 17:22:26 +01:00
criteria.c container: Move pending state to state struct 2021-02-16 22:05:00 -05:00
decoration.c Fix double free when unmapping any view 2018-11-15 15:22:09 +10:00
ipc-json.c container: Move pending state to state struct 2021-02-16 22:05:00 -05:00
ipc-server.c Fix incorrect format specifiers 2020-07-30 22:02:42 -04:00
main.c common: handle invalid IPC messages 2021-05-07 21:10:03 +02:00
meson.build Automatically map built-in touchscreens/tablets to built-in panels 2021-02-25 09:38:00 -05:00
server.c Remove WLR_HAS_XDG_FOREIGN checks 2021-04-11 19:14:05 +02:00
sway-bar.5.scd Add support for workspace_min_width bar option. 2020-10-11 19:12:42 +02:00
sway-input.5.scd man: document input XXX map_to_output * 2021-02-25 09:38:00 -05:00
sway-ipc.7.scd document parse_error 2020-11-21 11:42:29 +01:00
sway-output.5.scd Add toggle logic inside DPMS handler 2021-03-25 11:01:04 +01:00
sway.1.scd man: update maintainer 2021-01-08 09:33:51 +01:00
sway.5.scd Change workspace_layout to match i3 behavior 2020-12-20 00:58:42 -05:00
swaynag.c Use execlp("sh") instead of execl("/bin/sh") 2021-04-22 23:12:49 +02:00
xdg_decoration.c Fix xdg-decoration unconfigured if set before first commit 2019-05-03 15:37:32 -06:00