aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/vfs_extattr.c
diff options
context:
space:
mode:
authorConrad Meyer <cem@FreeBSD.org>2020-05-14 03:01:23 +0000
committerConrad Meyer <cem@FreeBSD.org>2020-05-14 03:01:23 +0000
commitb21ae0ff6fa29d05edf12744ac8c4ec5fc8562bc (patch)
tree1d0400459166f0f5cea63bb38096731187bb8fe6 /sys/kern/vfs_extattr.c
parentb18e0a534fb34767b1572cbf13805918c880be26 (diff)
downloadsrc-b21ae0ff6fa29d05edf12744ac8c4ec5fc8562bc.tar.gz
src-b21ae0ff6fa29d05edf12744ac8c4ec5fc8562bc.zip
vfs_extattr: Allow extattr names up to the full max
Extattr names are allowed to be 255 bytes -- not 254 bytes plus trailing NUL. Provide a 256 buffer so that copyinstr() has room for the trailing NUL. Re-enable test for maximal name lengths. PR: 208965 Reported by: asomers Reviewed by: asomers Differential Revision: https://reviews.freebsd.org/D24584
Notes
Notes: svn path=/head/; revision=361021
Diffstat (limited to 'sys/kern/vfs_extattr.c')
-rw-r--r--sys/kern/vfs_extattr.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c
index 1be73b95c0e9..adb882288f6c 100644
--- a/sys/kern/vfs_extattr.c
+++ b/sys/kern/vfs_extattr.c
@@ -82,7 +82,7 @@ sys_extattrctl(struct thread *td, struct extattrctl_args *uap)
struct vnode *filename_vp;
struct nameidata nd;
struct mount *mp, *mp_writable;
- char attrname[EXTATTR_MAXNAMELEN];
+ char attrname[EXTATTR_MAXNAMELEN + 1];
int error;
AUDIT_ARG_CMD(uap->cmd);
@@ -92,7 +92,7 @@ sys_extattrctl(struct thread *td, struct extattrctl_args *uap)
* invoke the VFS call so as to pass in NULL there if needed.
*/
if (uap->attrname != NULL) {
- error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN,
+ error = copyinstr(uap->attrname, attrname, sizeof(attrname),
NULL);
if (error)
return (error);
@@ -231,13 +231,13 @@ int
sys_extattr_set_fd(struct thread *td, struct extattr_set_fd_args *uap)
{
struct file *fp;
- char attrname[EXTATTR_MAXNAMELEN];
+ char attrname[EXTATTR_MAXNAMELEN + 1];
cap_rights_t rights;
int error;
AUDIT_ARG_FD(uap->fd);
AUDIT_ARG_VALUE(uap->attrnamespace);
- error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL);
+ error = copyinstr(uap->attrname, attrname, sizeof(attrname), NULL);
if (error)
return (error);
AUDIT_ARG_TEXT(attrname);
@@ -293,11 +293,11 @@ kern_extattr_set_path(struct thread *td, const char *path, int attrnamespace,
const char *uattrname, void *data, size_t nbytes, int follow)
{
struct nameidata nd;
- char attrname[EXTATTR_MAXNAMELEN];
+ char attrname[EXTATTR_MAXNAMELEN + 1];
int error;
AUDIT_ARG_VALUE(attrnamespace);
- error = copyinstr(uattrname, attrname, EXTATTR_MAXNAMELEN, NULL);
+ error = copyinstr(uattrname, attrname, sizeof(attrname), NULL);
if (error)
return (error);
AUDIT_ARG_TEXT(attrname);
@@ -398,13 +398,13 @@ int
sys_extattr_get_fd(struct thread *td, struct extattr_get_fd_args *uap)
{
struct file *fp;
- char attrname[EXTATTR_MAXNAMELEN];
+ char attrname[EXTATTR_MAXNAMELEN + 1];
cap_rights_t rights;
int error;
AUDIT_ARG_FD(uap->fd);
AUDIT_ARG_VALUE(uap->attrnamespace);
- error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL);
+ error = copyinstr(uap->attrname, attrname, sizeof(attrname), NULL);
if (error)
return (error);
AUDIT_ARG_TEXT(attrname);
@@ -458,11 +458,11 @@ kern_extattr_get_path(struct thread *td, const char *path, int attrnamespace,
const char *uattrname, void *data, size_t nbytes, int follow)
{
struct nameidata nd;
- char attrname[EXTATTR_MAXNAMELEN];
+ char attrname[EXTATTR_MAXNAMELEN + 1];
int error;
AUDIT_ARG_VALUE(attrnamespace);
- error = copyinstr(uattrname, attrname, EXTATTR_MAXNAMELEN, NULL);
+ error = copyinstr(uattrname, attrname, sizeof(attrname), NULL);
if (error)
return (error);
AUDIT_ARG_TEXT(attrname);
@@ -533,13 +533,13 @@ int
sys_extattr_delete_fd(struct thread *td, struct extattr_delete_fd_args *uap)
{
struct file *fp;
- char attrname[EXTATTR_MAXNAMELEN];
+ char attrname[EXTATTR_MAXNAMELEN + 1];
cap_rights_t rights;
int error;
AUDIT_ARG_FD(uap->fd);
AUDIT_ARG_VALUE(uap->attrnamespace);
- error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL);
+ error = copyinstr(uap->attrname, attrname, sizeof(attrname), NULL);
if (error)
return (error);
AUDIT_ARG_TEXT(attrname);
@@ -590,11 +590,11 @@ kern_extattr_delete_path(struct thread *td, const char *path, int attrnamespace,
const char *uattrname, int follow)
{
struct nameidata nd;
- char attrname[EXTATTR_MAXNAMELEN];
+ char attrname[EXTATTR_MAXNAMELEN + 1];
int error;
AUDIT_ARG_VALUE(attrnamespace);
- error = copyinstr(uattrname, attrname, EXTATTR_MAXNAMELEN, NULL);
+ error = copyinstr(uattrname, attrname, sizeof(attrname), NULL);
if (error)
return(error);
AUDIT_ARG_TEXT(attrname);