pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/sysutils/htop htop: Apply a reliability hotfix. Thank...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/87943a98de62
branches:  trunk
changeset: 378831:87943a98de62
user:      nia <nia%pkgsrc.org@localhost>
date:      Sat May 07 07:35:06 2022 +0000

description:
htop: Apply a reliability hotfix.  Thanks upstream for notice.

diffstat:

 sysutils/htop/Makefile                         |   3 +-
 sysutils/htop/distinfo                         |   5 ++-
 sysutils/htop/patches/patch-netbsd_Platform.c  |  31 +++++++++++++++++
 sysutils/htop/patches/patch-openbsd_Platform.c |  31 +++++++++++++++++
 sysutils/htop/patches/patch-solaris_Platform.c |  47 ++++++++++++++++++++++++++
 5 files changed, 115 insertions(+), 2 deletions(-)

diffs (146 lines):

diff -r c425e99f7b9d -r 87943a98de62 sysutils/htop/Makefile
--- a/sysutils/htop/Makefile    Sat May 07 07:33:45 2022 +0000
+++ b/sysutils/htop/Makefile    Sat May 07 07:35:06 2022 +0000
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.24 2022/01/20 22:48:41 fox Exp $
+# $NetBSD: Makefile,v 1.25 2022/05/07 07:35:06 nia Exp $
 
 DISTNAME=      htop-3.1.2
+PKGREVISION=   1
 CATEGORIES=    sysutils
 MASTER_SITES=  ${MASTER_SITE_GITHUB:=htop-dev/}
 
diff -r c425e99f7b9d -r 87943a98de62 sysutils/htop/distinfo
--- a/sysutils/htop/distinfo    Sat May 07 07:33:45 2022 +0000
+++ b/sysutils/htop/distinfo    Sat May 07 07:35:06 2022 +0000
@@ -1,5 +1,8 @@
-$NetBSD: distinfo,v 1.18 2022/01/20 22:48:41 fox Exp $
+$NetBSD: distinfo,v 1.19 2022/05/07 07:35:06 nia Exp $
 
 BLAKE2s (htop-3.1.2.tar.gz) = 7e6269d4f0b4e78772c6f8478df5c752ea966a227fdfc824bbd7fafd6380b5f4
 SHA512 (htop-3.1.2.tar.gz) = 7e08b820042e480ca61137ff24b468804b49b95c1bbedaf82029dd79d29c2c541c5211284ec075692203788bbb868a9d4326ffd24c68419e22eec13ae5012700
 Size (htop-3.1.2.tar.gz) = 387656 bytes
+SHA1 (patch-netbsd_Platform.c) = a84e3a0c4c66e0da8df9825cdee3edb756dda2eb
+SHA1 (patch-openbsd_Platform.c) = 0b4a7022a2b5be4f9ec7b8e11bff86835e86a951
+SHA1 (patch-solaris_Platform.c) = b61123345578f36d0859db28ee9183cd23e889ce
diff -r c425e99f7b9d -r 87943a98de62 sysutils/htop/patches/patch-netbsd_Platform.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/htop/patches/patch-netbsd_Platform.c     Sat May 07 07:35:06 2022 +0000
@@ -0,0 +1,31 @@
+$NetBSD: patch-netbsd_Platform.c,v 1.1 2022/05/07 07:35:06 nia Exp $
+
+Ensure buffer for environment is large enough
+
+https://github.com/htop-dev/htop/pull/997
+
+--- netbsd/Platform.c.orig     2021-11-30 01:03:21.000000000 +0000
++++ netbsd/Platform.c
+@@ -303,7 +303,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);
+       }
+@@ -319,6 +325,7 @@ char* Platform_getProcessEnv(pid_t pid) 
+       env[size + 1] = 0;
+    }
+ 
++end:
+    (void) kvm_close(kt);
+    return env;
+ }
diff -r c425e99f7b9d -r 87943a98de62 sysutils/htop/patches/patch-openbsd_Platform.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/htop/patches/patch-openbsd_Platform.c    Sat May 07 07:35:06 2022 +0000
@@ -0,0 +1,31 @@
+$NetBSD: patch-openbsd_Platform.c,v 1.1 2022/05/07 07:35:06 nia Exp $
+
+Ensure buffer for environment is large enough
+
+https://github.com/htop-dev/htop/pull/997
+
+--- openbsd/Platform.c.orig    2021-11-30 01:03:21.000000000 +0000
++++ openbsd/Platform.c
+@@ -261,7 +261,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);
+       }
+@@ -277,6 +283,7 @@ char* Platform_getProcessEnv(pid_t pid) 
+       env[size + 1] = 0;
+    }
+ 
++end:
+    (void) kvm_close(kt);
+    return env;
+ }
diff -r c425e99f7b9d -r 87943a98de62 sysutils/htop/patches/patch-solaris_Platform.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/htop/patches/patch-solaris_Platform.c    Sat May 07 07:35:06 2022 +0000
@@ -0,0 +1,47 @@
+$NetBSD: patch-solaris_Platform.c,v 1.1 2022/05/07 07:35:06 nia Exp $
+
+Ensure buffer for environment is large enough
+
+https://github.com/htop-dev/htop/pull/997
+
+--- solaris/Platform.c.orig    2021-11-30 01:03:21.000000000 +0000
++++ solaris/Platform.c
+@@ -259,16 +259,21 @@ static int Platform_buildenv(void* accum
+    envAccum* accump = accum;
+    (void) Phandle;
+    (void) addr;
++
+    size_t thissz = strlen(str);
+-   if ((thissz + 2) > (accump->capacity - accump->size)) {
+-      accump->env = xRealloc(accump->env, accump->capacity *= 2);
+-   }
+-   if ((thissz + 2) > (accump->capacity - accump->size)) {
+-      return 1;
++
++   while ((thissz + 2) > (accump->capacity - accump->size)) {
++      if (accump->capacity > (SIZE_MAX / 2))
++         return 1;
++
++      accump->capacity *= 2;
++      accump->env = xRealloc(accump->env, accump->capacity);
+    }
+-   strlcpy( accump->env + accump->size, str, (accump->capacity - accump->size));
++
++   strlcpy( accump->env + accump->size, str, accump->capacity - accump->size);
+    strncpy( accump->env + accump->size + thissz + 1, "\n", 2);
+-   accump->size = accump->size + thissz + 1;
++
++   accump->size += thissz + 1;
+    return 0;
+ }
+ 
+@@ -291,7 +296,8 @@ char* Platform_getProcessEnv(pid_t pid) 
+    Prelease(Phandle, 0);
+ 
+    strncpy( envBuilder.env + envBuilder.size, "\0", 1);
+-   return envBuilder.env;
++
++   return xRealloc(envBuilder.env, envBuilder.size + 1);
+ }
+ 
+ char* Platform_getInodeFilename(pid_t pid, ino_t inode) {



Home | Main Index | Thread Index | Old Index