Skip to content

Fix missing null byte in gfal_plugin_file_readlink

Chris Burr requested to merge cburr/gfal2:fix-readlink-overrun into develop

readlink() does not append a terminating null byte to buf while the readlinkG interface assumes one has been added. This can cause garbage data to be appended to the string:

>       assert ctx.readlink(f"file://{link_path}") == str(real_path)
E       AssertionError: assert '/tmp/cburr/pytest-of-cburr/pytest-81/test_readlink0/real.txt:V' == '/tmp/cburr/pytest-of-cburr/pytest-81/test_readlink0/real.txt'
E         - /tmp/cburr/pytest-of-cburr/pytest-81/test_readlink0/real.txt
E         + /tmp/cburr/pytest-of-cburr/pytest-81/test_readlink0/real.txt:V
E         ?

I haven't tested if this PR actually fixes the issue as I don't have an development environment lying around at the moment.

Edited by Chris Burr

Merge request reports