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:
Jim Meyering 2012-10-04 13:09:52 +02:00 committed by Anthony Liguori
parent 3eadc68ebd
commit ae21506801
1 changed files with 1 additions and 1 deletions

View File

@ -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;
}