diff options
author | Daniel Lange <DLange@git.local> | 2022-06-03 08:55:20 +0200 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2022-06-03 08:55:20 +0200 |
commit | 937052b231259a47d881d539ad5748245ef55b99 (patch) | |
tree | 41071229fa007d8cf6902bb9253d2acd8cc66979 /netbsd/Platform.c | |
parent | 1b805a31720727008b32b1129a167758519fd4db (diff) | |
download | debian_htop-937052b231259a47d881d539ad5748245ef55b99.tar.gz debian_htop-937052b231259a47d881d539ad5748245ef55b99.tar.bz2 debian_htop-937052b231259a47d881d539ad5748245ef55b99.zip |
New upstream version 3.2.1upstream/3.2.1
Diffstat (limited to 'netbsd/Platform.c')
-rw-r--r-- | netbsd/Platform.c | 9 |
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; } |