Fix FTBFS on GNU/Hurd

Currently appstream-glib FTBFS on GNU/Hurd due to usage of PATH_MAX,
which is not defined. The attached patch solves this problem by
dynamically allocating strings of required length, and free them after
usage if needed.

Many thanks to Svante Signell <svante.signell@gmail.com> for the patch!