[UserMetaData] Handle changes in attribute data size correctly

Authored by bruns on Mar 30 2019, 10:43 PM.

Description

[UserMetaData] Handle changes in attribute data size correctly

Summary:
There is no guarantee the attribute size does not change between two
getxattr calls (and the man page explicitly mentions this case).

In case the attribute grows only a truncated value is returned, when it
shrinks, garbage is returned. In both cases Unicode decoding errors can
happen.

Test Plan: ctest

Reviewers: Baloo, Frameworks, ngraham, astippich

Reviewed By: Baloo, ngraham

Subscribers: kde-frameworks-devel

Tags: Frameworks, Baloo

Differential Revision: https://phabricator.kde.org/D20136

Details