mirror of
https://github.com/torvalds/linux.git
synced 2026-11-09 13:44:03 +01:00
um: mconsole: use bounded version string formatting
mconsole_version() formats several UTS strings into a fixed 256-byte local buffer with sprintf() and no length bound. Use snprintf() so the version reply stays within the local buffer. Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn> Link: https://patch.msgid.link/20260408160001.1-um-mconsole-v2-pengpeng@iscas.ac.cn Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
2f89719949
commit
5bde583d13
|
|
@ -106,9 +106,9 @@ void mconsole_version(struct mc_request *req)
|
|||
{
|
||||
char version[256];
|
||||
|
||||
sprintf(version, "%s %s %s %s %s", utsname()->sysname,
|
||||
utsname()->nodename, utsname()->release, utsname()->version,
|
||||
utsname()->machine);
|
||||
snprintf(version, sizeof(version), "%s %s %s %s %s",
|
||||
utsname()->sysname, utsname()->nodename, utsname()->release,
|
||||
utsname()->version, utsname()->machine);
|
||||
mconsole_reply(req, version, 0, 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user