mirror of https://github.com/xzeldon/htop.git
Fix a possible truncation of the intermediate strings in the SysArch meter
This commit is contained in:
parent
7b48fec59a
commit
8a1112141d
|
@ -62,11 +62,18 @@ static void parseOSRelease(char* buffer, size_t bufferLen) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SysArchMeter_updateValues(ATTR_UNUSED Meter* this, char* buffer, size_t size) {
|
static void SysArchMeter_updateValues(ATTR_UNUSED Meter* this, char* buffer, size_t size) {
|
||||||
static char savedString[128] = {'\0'};
|
static struct utsname uname_info;
|
||||||
|
|
||||||
|
static char savedString[
|
||||||
|
/* uname structure fields - manpages recommend sizeof */
|
||||||
|
sizeof(uname_info.sysname) +
|
||||||
|
sizeof(uname_info.release) +
|
||||||
|
sizeof(uname_info.machine) +
|
||||||
|
16/*markup*/ +
|
||||||
|
128/*distro*/] = {'\0'};
|
||||||
static bool loaded_data = false;
|
static bool loaded_data = false;
|
||||||
|
|
||||||
if (!loaded_data) {
|
if (!loaded_data) {
|
||||||
struct utsname uname_info;
|
|
||||||
int uname_result = uname(&uname_info);
|
int uname_result = uname(&uname_info);
|
||||||
|
|
||||||
char distro[128];
|
char distro[128];
|
||||||
|
|
Loading…
Reference in New Issue