lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Wed, 09 Apr 2008 18:41:33 +0200
From:	Markus Armbruster <armbru@...hat.com>
To:	linux-kernel@...r.kernel.org
Cc:	Adrian Bunk <bunk@...nel.org>
Subject: [PATCH] printk: Don't read beyond string arguments' terminating zero

Fix add_preferred_console() and update_console_cmdline() not to to
read beyond the terminating zero of their name argument.

Signed-off-by: Markus Armbruster <armbru@...hat.com>
---
 kernel/printk.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/printk.c b/kernel/printk.c
index c46a20a..52526df 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -865,7 +865,7 @@ int add_preferred_console(char *name, int idx, char *options)
 		return -E2BIG;
 	selected_console = i;
 	c = &console_cmdline[i];
-	memcpy(c->name, name, sizeof(c->name));
+	strlcpy(c->name, name, sizeof(c->name));
 	c->name[sizeof(c->name) - 1] = 0;
 	c->options = options;
 	c->index = idx;
@@ -881,7 +881,7 @@ int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, cha
 		if (strcmp(console_cmdline[i].name, name) == 0 &&
 			  console_cmdline[i].index == idx) {
 				c = &console_cmdline[i];
-				memcpy(c->name, name_new, sizeof(c->name));
+				strlcpy(c->name, name_new, sizeof(c->name));
 				c->name[sizeof(c->name) - 1] = 0;
 				c->options = options;
 				c->index = idx_new;
-- 
1.5.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ