summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_conf.c
diff options
context:
space:
mode:
authorjh <jh@FreeBSD.org>2012-12-22 13:33:28 +0000
committerjh <jh@FreeBSD.org>2012-12-22 13:33:28 +0000
commitde8a1071d5920bcdea674f08250851affe15dc4f (patch)
treeca421b04ae201d70a9ecb7d6d2dc686c5c9b74b5 /sys/kern/kern_conf.c
parentd2861e92958113d0e11a6d2708af91daa4ed0125 (diff)
downloadFreeBSD-src-de8a1071d5920bcdea674f08250851affe15dc4f.zip
FreeBSD-src-de8a1071d5920bcdea674f08250851affe15dc4f.tar.gz
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
Diffstat (limited to 'sys/kern/kern_conf.c')
-rw-r--r--sys/kern/kern_conf.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c
index 288fac5..c04d1da 100644
--- a/sys/kern/kern_conf.c
+++ b/sys/kern/kern_conf.c
@@ -698,6 +698,13 @@ prep_devname(struct cdev *dev, const char *fmt, va_list ap)
;
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. */
while (from[0] == '/' && from[1] == '/')
from++;
OpenPOWER on IntegriCloud