From 937052b231259a47d881d539ad5748245ef55b99 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Fri, 3 Jun 2022 08:55:20 +0200 Subject: New upstream version 3.2.1 --- netbsd/NetBSDProcess.c | 2 +- netbsd/Platform.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'netbsd') diff --git a/netbsd/NetBSDProcess.c b/netbsd/NetBSDProcess.c index a7d59be..4d4ac4e 100644 --- a/netbsd/NetBSDProcess.c +++ b/netbsd/NetBSDProcess.c @@ -144,7 +144,7 @@ const ProcessFieldData Process_fields[LAST_PROCESSFIELD] = { }, [PERCENT_CPU] = { .name = "PERCENT_CPU", - .title = "CPU% ", + .title = " CPU%", .description = "Percentage of the CPU time the process used in the last sampling", .flags = 0, .defaultSortDesc = true, diff --git a/netbsd/Platform.c b/netbsd/Platform.c index 1812ddd..cf6079d 100644 --- a/netbsd/Platform.c +++ b/netbsd/Platform.c @@ -311,7 +311,13 @@ char* Platform_getProcessEnv(pid_t pid) { for (char** p = ptr; *p; p++) { size_t len = strlen(*p) + 1; - if (size + len > capacity) { + while (size + len > capacity) { + if (capacity > (SIZE_MAX / 2)) { + free(env); + env = NULL; + goto end; + } + capacity *= 2; env = xRealloc(env, capacity); } @@ -327,6 +333,7 @@ char* Platform_getProcessEnv(pid_t pid) { env[size + 1] = 0; } +end: (void) kvm_close(kt); return env; } -- cgit v1.2.3