From 361371201b60ffd686a694c848c1d5ad6061725f Mon Sep 17 00:00:00 2001 From: Balbir Singh Date: Tue, 9 Dec 2008 13:14:07 -0800 Subject: uml: boot broken due to buffer overrun mconsole_init() passed 256 bytes as length in os_create_unix_socket, while the sizeof UNIX_PATH_MAX is 108. This patch fixes that problem and avoids a big overrun bug reported on UML bootup. sockaddr_un.sun_path is UNIX_PATH_MAX long which causes the problem. Reported-by: Vikas K Managutte Reported-by: Sarvesh Kumar Lal Das Signed-off-by: Balbir Singh Reviewed-by: Pekka Enberg Reviewed-by: WANG Cong Cc: Jeff Dike Cc: [please check with Jeff] Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/um/drivers/mconsole_kern.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'arch') diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c index 19d579d74d27..8f44ebb0dec8 100644 --- a/arch/um/drivers/mconsole_kern.c +++ b/arch/um/drivers/mconsole_kern.c @@ -16,6 +16,8 @@ #include #include #include +#include +#include #include #include #include @@ -785,7 +787,7 @@ static int __init mconsole_init(void) /* long to avoid size mismatch warnings from gcc */ long sock; int err; - char file[256]; + char file[UNIX_PATH_MAX]; if (umid_file_name("mconsole", file, sizeof(file))) return -1; -- cgit v1.2.3