mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-28 05:50:37 +00:00
ppc: avoid buffer overrun: use pstrcpy, not strncpy
A terminal NUL is required by caller's use of strchr. It's better not to use strncpy at all, since there is no need to zero out hundreds of trailing bytes for each iteration. Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
3eadc68ebd
commit
ae21506801
@ -795,7 +795,7 @@ static int read_cpuinfo(const char *field, char *value, int len)
|
||||
break;
|
||||
}
|
||||
if (!strncmp(line, field, field_len)) {
|
||||
strncpy(value, line, len);
|
||||
pstrcpy(value, len, line);
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user