sway/common
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
..
background-image.c swaybg: split into standalone project 2019-04-25 18:44:28 +03:00
cairo.c swaybg: split into standalone project 2019-04-25 18:44:28 +03:00
ipc-client.c common: handle invalid IPC messages 2021-05-07 21:10:03 +02:00
list.c Merge pull request #3271 from ianyfan/list-cleanup 2018-12-09 21:50:19 +10:00
log.c common/log: write log importance 2020-12-10 09:26:02 +01:00
loop.c common/loop: check return of realloc 2020-07-30 22:02:42 -04:00
meson.build Add wayland_client dependency to common 2020-06-06 11:03:04 +02:00
pango.c Replace wlr_log with sway_log 2019-01-21 12:59:42 +01:00
stringop.c common: make 'lenient_strcmp' arguments const 2020-12-04 10:49:49 +01:00
util.c moved and renamed movement-unit parsing to common 2020-07-21 10:07:01 +02:00