mirror of
https://github.com/Motorhead1991/qemu.git
synced 2026-01-06 14:37:42 -07: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
1 changed files with 1 additions and 1 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue