Commit ae215068 authored by Jim Meyering's avatar Jim Meyering Committed by Anthony Liguori
Browse files

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: default avatarJim Meyering <meyering@redhat.com>
Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
parent 3eadc68e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
        }