Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F154444832
D52039.id160642.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
877 B
Referenced Files
None
Subscribers
None
D52039.id160642.diff
View Options
diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c
--- a/sys/kern/kern_jail.c
+++ b/sys/kern/kern_jail.c
@@ -4847,13 +4847,19 @@
vfsp->vfc_prison_flag = prison_add_allow("mount", vfsp->vfc_name,
NULL, NULL);
#else
- char *descr;
+ static const char fmtstring[] = "Jail may mount the %s file system";
+ char descr[sizeof(fmtstring) + sizeof(vfsp->vfc_name)];
- (void)asprintf(&descr, M_TEMP, "Jail may mount the %s file system",
- vfsp->vfc_name);
+ /*
+ * Mostly defending against vfc_name somehow being turned into a
+ * pointer, but that seems unlikely.
+ */
+ _Static_assert(sizeof(vfsp->vfc_name) >= MFSNAMELEN,
+ "vfc_name expected to be an array");
+
+ (void)snprintf(descr, sizeof(descr), fmtstring, vfsp->vfc_name);
vfsp->vfc_prison_flag = prison_add_allow("mount", vfsp->vfc_name,
NULL, descr);
- free(descr, M_TEMP);
#endif
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 29, 2:49 PM (2 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32352014
Default Alt Text
D52039.id160642.diff (877 B)
Attached To
Mode
D52039: kern: remove the need to allocate in prison_add_vfs()
Attached
Detach File
Event Timeline
Log In to Comment