Commit f735295b14ae073a8302d7b1da894bc597724557

Authored by Markus Armbruster
Committed by Linus Torvalds
1 parent f7511d5f66

printk: don't read beyond string arguments' terminating zero

Fix update_console_cmdline() not to to read beyond the terminating zero of its
name argument.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

... ... @@ -921,7 +921,7 @@
921 921 if (strcmp(console_cmdline[i].name, name) == 0 &&
922 922 console_cmdline[i].index == idx) {
923 923 c = &console_cmdline[i];
924   - memcpy(c->name, name_new, sizeof(c->name));
  924 + strlcpy(c->name, name_new, sizeof(c->name));
925 925 c->name[sizeof(c->name) - 1] = 0;
926 926 c->options = options;
927 927 c->index = idx_new;