Reject spaces and double quotation marks in device names. devctl(4)
and devd(8) can't handle names with such characters properly. PR: bin/144736, kern/161912 Discussed with: imp, kib, pjd
This commit is contained in:
parent
cd2fe4e632
commit
b1e1f725e7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=244584
@ -24,7 +24,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd May 3, 2011
|
.Dd Dec 22, 2012
|
||||||
.Dt MAKE_DEV 9
|
.Dt MAKE_DEV 9
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -364,6 +364,10 @@ or
|
|||||||
.Qq ..
|
.Qq ..
|
||||||
path component or ends with
|
path component or ends with
|
||||||
.Ql / .
|
.Ql / .
|
||||||
|
.It Bq Er EINVAL
|
||||||
|
The
|
||||||
|
.Dv MAKEDEV_CHECKNAME
|
||||||
|
flag was specified and the provided device name contains invalid characters.
|
||||||
.It Bq Er EEXIST
|
.It Bq Er EEXIST
|
||||||
The
|
The
|
||||||
.Dv MAKEDEV_CHECKNAME
|
.Dv MAKEDEV_CHECKNAME
|
||||||
|
@ -698,6 +698,13 @@ prep_devname(struct cdev *dev, const char *fmt, va_list ap)
|
|||||||
;
|
;
|
||||||
|
|
||||||
for (to = dev->si_name; *from != '\0'; from++, to++) {
|
for (to = dev->si_name; *from != '\0'; from++, to++) {
|
||||||
|
/*
|
||||||
|
* Spaces and double quotation marks cause
|
||||||
|
* problems for the devctl(4) protocol.
|
||||||
|
* Reject names containing those characters.
|
||||||
|
*/
|
||||||
|
if (isspace(*from) || *from == '"')
|
||||||
|
return (EINVAL);
|
||||||
/* Treat multiple sequential slashes as single. */
|
/* Treat multiple sequential slashes as single. */
|
||||||
while (from[0] == '/' && from[1] == '/')
|
while (from[0] == '/' && from[1] == '/')
|
||||||
from++;
|
from++;
|
||||||
|
Loading…
Reference in New Issue
Block a user