tools/power turbostat: Fix gcc build warnings

Warning: ‘__builtin_strncpy’ specified bound 20 equals destination size
	[-Wstringop-truncation]

reduce param to strncpy, to guarantee that a null byte is always copied
into destination buffer.

Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
Len Brown 2020-03-19 18:33:12 -04:00
Родитель 081c54323b
Коммит d8d005ba6a
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -5325,9 +5325,9 @@ int add_counter(unsigned int msr_num, char *path, char *name,
}
msrp->msr_num = msr_num;
strncpy(msrp->name, name, NAME_BYTES);
strncpy(msrp->name, name, NAME_BYTES - 1);
if (path)
strncpy(msrp->path, path, PATH_BYTES);
strncpy(msrp->path, path, PATH_BYTES - 1);
msrp->width = width;
msrp->type = type;
msrp->format = format;