cap_filergs: limit size of the file name
The limit of the name in fileargs is twice the size of the MAXPATH. The nvlist will not add an element with the longer name. We can detect at this point that the path is too big, and simple return the same error as open(2) would. PR: 239700 Reported by: markj Tested by: markj MFC after: 2 weeks
This commit is contained in:
parent
ac03832ef3
commit
9509775394
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=350695
@ -185,6 +185,11 @@ fileargs_create_limit(int argc, const char * const *argv, int flags,
|
||||
nvlist_add_number(limits, "mode", (uint64_t)mode);
|
||||
|
||||
for (i = 0; i < argc; i++) {
|
||||
if (strlen(argv[i]) >= MAXPATHLEN) {
|
||||
nvlist_destroy(limits);
|
||||
errno = ENAMETOOLONG;
|
||||
return (NULL);
|
||||
}
|
||||
nvlist_add_null(limits, argv[i]);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user