mini-os: handle possibly overlong _nodename in init_consfront

The only current user that passes a non-NULL _nodename limits it to 64
bytes anyway.

Coverity-ID: 1054993
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
This commit is contained in:
Matthew Daley authored and Ian Campbell committed 2013-09-13 13:15:02 +01:00
1 parent 72b9c3e88c
commit 6425b20c0f
1 file changed
+4 -2
+4 -2
View File
@@ -70,8 +70,10 @@ struct consfront_dev *init_consfront(char *_nodename)
if (!_nodename)
snprintf(nodename, sizeof(nodename), "device/console/%d", consfrontends);
else
strncpy(nodename, _nodename, sizeof(nodename));
else {
strncpy(nodename, _nodename, sizeof(nodename) - 1);
nodename[sizeof(nodename) - 1] = 0;
}
printk("******************* CONSFRONT for %s **********\n\n\n", nodename);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.