aboutsummaryrefslogtreecommitdiffstats
path: root/netbsd/Platform.c
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2022-06-03 08:55:21 +0200
committerDaniel Lange <DLange@git.local>2022-06-03 08:55:21 +0200
commitf8c86394f62c6e6f950fcbbff008f639db33241c (patch)
treee82dcf1ba008020628c96661587ed870e0cac179 /netbsd/Platform.c
parent4d3dbd693ecd079d5907d81d5d2ff191baa61033 (diff)
parent937052b231259a47d881d539ad5748245ef55b99 (diff)
downloaddebian_htop-f8c86394f62c6e6f950fcbbff008f639db33241c.tar.gz
debian_htop-f8c86394f62c6e6f950fcbbff008f639db33241c.tar.bz2
debian_htop-f8c86394f62c6e6f950fcbbff008f639db33241c.zip
Update upstream source from tag 'upstream/3.2.1'
Update to upstream version '3.2.1' with Debian dir 43b873ddb7f7032e95da61a9cb65eee15c671e73
Diffstat (limited to 'netbsd/Platform.c')
-rw-r--r--netbsd/Platform.c9
1 files changed, 8 insertions, 1 deletions
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;
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy