git: 8d0ca017408e - stable/13 - Update capsicum-test to eab7a83b05becf64439b4b256b3d756b353fbbbb
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 07 May 2024 00:04:40 UTC
The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=8d0ca017408ed87de0e3f8746421e88a834b9bb0 commit 8d0ca017408ed87de0e3f8746421e88a834b9bb0 Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2022-09-13 17:39:02 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2024-05-07 00:03:52 +0000 Update capsicum-test to eab7a83b05becf64439b4b256b3d756b353fbbbb (cherry picked from commit 4ee9db7a1d428a0c067ad4c65591972872eb2ade) PR: 266112 --- contrib/capsicum-test/syscalls.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/contrib/capsicum-test/syscalls.h b/contrib/capsicum-test/syscalls.h index 592a1677e1f1..3ea8803c2f64 100644 --- a/contrib/capsicum-test/syscalls.h +++ b/contrib/capsicum-test/syscalls.h @@ -47,16 +47,29 @@ inline int bogus_mount_() { /* Mappings for extended attribute functions */ #include <sys/extattr.h> +#include <errno.h> +static const char *fbsd_extattr_skip_prefix(const char *p) { + if (*p++ == 'u' && *p++ == 's' && *p++ == 'e' && *p++ == 'r' && *p++ == '.') + return p; + errno = EINVAL; + return NULL; +} inline ssize_t flistxattr_(int fd, char *list, size_t size) { return extattr_list_fd(fd, EXTATTR_NAMESPACE_USER, list, size); } inline ssize_t fgetxattr_(int fd, const char *name, void *value, size_t size) { + if (!(name = fbsd_extattr_skip_prefix(name))) + return -1; return extattr_get_fd(fd, EXTATTR_NAMESPACE_USER, name, value, size); } inline int fsetxattr_(int fd, const char *name, const void *value, size_t size, int) { + if (!(name = fbsd_extattr_skip_prefix(name))) + return -1; return extattr_set_fd(fd, EXTATTR_NAMESPACE_USER, name, value, size); } inline int fremovexattr_(int fd, const char *name) { + if (!(name = fbsd_extattr_skip_prefix(name))) + return -1; return extattr_delete_fd(fd, EXTATTR_NAMESPACE_USER, name); }