pkgsrc-Changes archive

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

CVS commit: pkgsrc/sysutils/htop



Module Name:    pkgsrc
Committed By:   nia
Date:           Sat May  7 07:35:06 UTC 2022

Modified Files:
        pkgsrc/sysutils/htop: Makefile distinfo
Added Files:
        pkgsrc/sysutils/htop/patches: patch-netbsd_Platform.c
            patch-openbsd_Platform.c patch-solaris_Platform.c

Log Message:
htop: Apply a reliability hotfix.  Thanks upstream for notice.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 pkgsrc/sysutils/htop/Makefile
cvs rdiff -u -r1.18 -r1.19 pkgsrc/sysutils/htop/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/sysutils/htop/patches/patch-netbsd_Platform.c \
    pkgsrc/sysutils/htop/patches/patch-openbsd_Platform.c \
    pkgsrc/sysutils/htop/patches/patch-solaris_Platform.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/sysutils/htop/Makefile
diff -u pkgsrc/sysutils/htop/Makefile:1.24 pkgsrc/sysutils/htop/Makefile:1.25
--- pkgsrc/sysutils/htop/Makefile:1.24  Thu Jan 20 22:48:41 2022
+++ pkgsrc/sysutils/htop/Makefile       Sat May  7 07:35:06 2022
@@ -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/}
 

Index: pkgsrc/sysutils/htop/distinfo
diff -u pkgsrc/sysutils/htop/distinfo:1.18 pkgsrc/sysutils/htop/distinfo:1.19
--- pkgsrc/sysutils/htop/distinfo:1.18  Thu Jan 20 22:48:41 2022
+++ pkgsrc/sysutils/htop/distinfo       Sat May  7 07:35:06 2022
@@ -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

Added files:

Index: pkgsrc/sysutils/htop/patches/patch-netbsd_Platform.c
diff -u /dev/null pkgsrc/sysutils/htop/patches/patch-netbsd_Platform.c:1.1
--- /dev/null   Sat May  7 07:35:07 2022
+++ pkgsrc/sysutils/htop/patches/patch-netbsd_Platform.c        Sat May  7 07:35:06 2022
@@ -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;
+ }
Index: pkgsrc/sysutils/htop/patches/patch-openbsd_Platform.c
diff -u /dev/null pkgsrc/sysutils/htop/patches/patch-openbsd_Platform.c:1.1
--- /dev/null   Sat May  7 07:35:07 2022
+++ pkgsrc/sysutils/htop/patches/patch-openbsd_Platform.c       Sat May  7 07:35:06 2022
@@ -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;
+ }
Index: pkgsrc/sysutils/htop/patches/patch-solaris_Platform.c
diff -u /dev/null pkgsrc/sysutils/htop/patches/patch-solaris_Platform.c:1.1
--- /dev/null   Sat May  7 07:35:07 2022
+++ pkgsrc/sysutils/htop/patches/patch-solaris_Platform.c       Sat May  7 07:35:06 2022
@@ -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