mirror of
https://github.com/swaywm/sway.git
synced 2026-04-22 06:46:27 -04:00
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.')
```
|
||
|---|---|---|
| .. | ||
| sway | ||
| swaybar | ||
| swaynag | ||
| background-image.h | ||
| cairo.h | ||
| ipc-client.h | ||
| ipc.h | ||
| list.h | ||
| log.h | ||
| loop.h | ||
| meson.build | ||
| pango.h | ||
| pool-buffer.h | ||
| stringop.h | ||
| util.h | ||