Fix compatibility with libxml 2.12

As described in #184, compiz crashes after Archlinux update (21 Nov 2023).

Debugging shows that this bug is caused by the libxml2 update from 2.11.5 to 2.12.0. Libxml2 no longer accepts documents ending with the '\0' character. This commit should fix the problem.

Additionally, #include <stdlib.h> is needed in src/metadata.c, otherwise the getenv() call in compAddMetadataFromFile will assign a pointer of the wrong size, resulting in subsequent strlen() to segfault.

I've tested this commit on both versions of libxml2 (2.11.5 and 2.12.0), and both work on my machine (x86_64 Archlinux, update 22 Nov 2023).

Merge request reports

Loading