Fix out of boundary read.

Merged Tobias Stoeckmann requested to merge tstoeckmann/xrdb:buffer into master

If a binary file which starts with 0x00 is edited, xrdb performs an off-by-one read outside of its buffer.

The fix is simple: Do not try to append an empty string to buffer, which would be a no-op anyway.

Proof of Concept (compile with -fsanitize=address):

$ dd if=/dev/zero bs=1 count=1 of=poc.txt $ xrdb -edit poc.txt

Signed-off-by: Tobias Stoeckmann

Edited by Tobias Stoeckmann

Merge request reports