git: 4ee9db7a1d42 - main - Update capsicum-test to eab7a83b05becf64439b4b256b3d756b353fbbbb

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Tue, 13 Sep 2022 17:42:58 UTC
The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=4ee9db7a1d428a0c067ad4c65591972872eb2ade

commit 4ee9db7a1d428a0c067ad4c65591972872eb2ade
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2022-09-13 17:39:02 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-09-13 17:42:46 +0000

    Update capsicum-test to eab7a83b05becf64439b4b256b3d756b353fbbbb
---
 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);
 }