Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail gracefully in case of unsupported extended file attributes #2130

Merged
merged 1 commit into from Nov 23, 2023

Conversation

ellert
Copy link
Contributor

@ellert ellert commented Nov 22, 2023

As discussed in #2129 (comment)

If extended attributes are not supported xattr->Get() returns -ENOTSUP. When this small negative value is cast to a size_t in the call to new on the following line it becomes a very large integer and the request to allocate this enormous memory block fails with a std::bad_alloc exception.

This commit adds a check on the returned size and returns an error if it is negative avoiding triggering the std::bad_alloc exception.

-ENOTSUP. When this small negative value is cast to a size_t in the
call to new on the following line it becomes a very large integer and
the request to allocate this enormous memory block fails with a
std::bad_alloc exception.

This commit adds a check on the returned size and returns an error if
it is negative avoiding triggering the std::bad_alloc exception.
@amadio amadio merged commit 5cfd2d7 into xrootd:devel Nov 23, 2023
13 checks passed
@ellert ellert deleted the graceful-xattr-not-supported branch November 23, 2023 13:52
@amadio amadio added this to the 5.6.4 milestone Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants