sway/include
Tobias Stoeckmann 06ab0d166a sway: prevent endless loop with broken clients
The server loops endlessly in following scenarios:
- client sends less bytes than IPC header requires
- client sends less bytes than defined by payload size
- client sends more payload data than buffered by operating system

This happens because the server relies on the buffering in sockets by
the operating system. The server only retrieves bytes from buffer when
enough bytes are available. To prevent this, store data in heap.

Also check supplied payload length before working with that value.

Proof of Concept client in Python (you will notice that sway process
consumes a lot of CPU while the client is running):
```
import os
import socket

swaysock=os.environ['SWAYSOCK']
client = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
client.connect(swaysock)
client.send(b'\x69\x33\x2D\x69\x70\x63\x00\x00\x00\x00\xFF\xFF\xFF\xFF\x00')
input('Press enter to quit.')
```
2021-05-07 21:12:28 +02:00
..
sway Remove support for arbitrary rotations 2021-04-26 10:36:25 +02:00
swaybar Fix swaybar tray for non-systemd 2020-12-16 21:19:20 +01:00
swaynag swaynag: add details background option 2020-09-14 22:13:01 -04:00
background-image.h Initial swaylock port 2018-04-04 18:47:48 -04:00
cairo.h swaybg: split into standalone project 2019-04-25 18:44:28 +03:00
ipc-client.h common: handle invalid IPC messages 2021-05-07 21:10:03 +02:00
ipc.h sway: prevent endless loop with broken clients 2021-05-07 21:12:28 +02:00
list.h list.c: rename free_flat_list to list_free_items_and_destroy 2018-12-09 01:15:38 +00:00
log.h Use -fmacro-prefix-map to strip build path 2019-07-15 16:35:50 -04:00
loop.h Remove timerfd from loop implementation 2018-10-15 00:26:27 +10:00
meson.build Address review comments 2018-03-28 14:43:23 -04:00
pango.h Fix pango escaping and refactor escape_markup_text 2018-09-22 18:33:28 +10:00
pool-buffer.h client/pool-buffer: munmap in destroy_buffer 2018-05-27 14:09:48 +01:00
stringop.h common: make 'lenient_strcmp' arguments const 2020-12-04 10:49:49 +01:00
util.h moved and renamed movement-unit parsing to common 2020-07-21 10:07:01 +02:00