pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/sysutils/py-psutil py-psutil: Fix psutil.Popen.as_dict...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/6a0ef54dfcc0
branches:  trunk
changeset: 334869:6a0ef54dfcc0
user:      leot <leot%pkgsrc.org@localhost>
date:      Fri Jun 07 19:09:06 2019 +0000

description:
py-psutil: Fix psutil.Popen.as_dict() MemoryError on NetBSD

Previously for kern.argmax a size_t was used in sysctl(3) and the
uninitialized data lead to a too big malloc() call that failed.

Bump PKGREVISION

diffstat:

 sysutils/py-psutil/Makefile                                    |   4 +-
 sysutils/py-psutil/distinfo                                    |   4 +-
 sysutils/py-psutil/patches/patch-psutil_arch_netbsd_specific.c |  33 +++++++++-
 3 files changed, 36 insertions(+), 5 deletions(-)

diffs (78 lines):

diff -r ad7ef87f2365 -r 6a0ef54dfcc0 sysutils/py-psutil/Makefile
--- a/sysutils/py-psutil/Makefile       Fri Jun 07 18:56:01 2019 +0000
+++ b/sysutils/py-psutil/Makefile       Fri Jun 07 19:09:06 2019 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.29 2019/06/01 01:11:57 kamil Exp $
+# $NetBSD: Makefile,v 1.30 2019/06/07 19:09:06 leot Exp $
 
 DISTNAME=      psutil-5.6.2
-PKGREVISION=   1
+PKGREVISION=   2
 PKGNAME=       ${PYPKGPREFIX}-${DISTNAME}
 CATEGORIES=    sysutils python
 MASTER_SITES=  ${MASTER_SITE_PYPI:=p/psutil/}
diff -r ad7ef87f2365 -r 6a0ef54dfcc0 sysutils/py-psutil/distinfo
--- a/sysutils/py-psutil/distinfo       Fri Jun 07 18:56:01 2019 +0000
+++ b/sysutils/py-psutil/distinfo       Fri Jun 07 19:09:06 2019 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.29 2019/06/01 01:11:57 kamil Exp $
+$NetBSD: distinfo,v 1.30 2019/06/07 19:09:06 leot Exp $
 
 SHA1 (psutil-5.6.2.tar.gz) = c01d48a103196eb513b72d32fbc7cee1ed64a38c
 RMD160 (psutil-5.6.2.tar.gz) = 5450a028ad787d3e274a2c0e11c127bf5cd7e9da
@@ -6,5 +6,5 @@
 Size (psutil-5.6.2.tar.gz) = 432907 bytes
 SHA1 (patch-psutil___psbsd.py) = f8888b8f386a1928446c7d588a7a46f2674c69f6
 SHA1 (patch-psutil___psutil__bsd.c) = 5516c6c257b389c7e977074d2a6eeb3c23f565d1
-SHA1 (patch-psutil_arch_netbsd_specific.c) = 3809727dcf605af44ec15f0ef5924acd65be5ea9
+SHA1 (patch-psutil_arch_netbsd_specific.c) = d43bc4d28212f75721df5a18287953d18a5673a4
 SHA1 (patch-psutil_arch_netbsd_specific.h) = 4d6b3c96eefeec4908e1006b96ab175d64714dd2
diff -r ad7ef87f2365 -r 6a0ef54dfcc0 sysutils/py-psutil/patches/patch-psutil_arch_netbsd_specific.c
--- a/sysutils/py-psutil/patches/patch-psutil_arch_netbsd_specific.c    Fri Jun 07 18:56:01 2019 +0000
+++ b/sysutils/py-psutil/patches/patch-psutil_arch_netbsd_specific.c    Fri Jun 07 19:09:06 2019 +0000
@@ -1,9 +1,12 @@
-$NetBSD: patch-psutil_arch_netbsd_specific.c,v 1.2 2019/06/01 01:11:57 kamil Exp $
+$NetBSD: patch-psutil_arch_netbsd_specific.c,v 1.3 2019/06/07 19:09:06 leot Exp $
 
 Don't include <sys/user.h> on NetBSD. Include <sys/iostat.h> instead.
 
 Use proc_cwd on NetBSD >= 8.99.42.
 
+Use an `int' to store `kern.argmax' to avoid possible read of
+uninitialized memory.
+
 --- psutil/arch/netbsd/specific.c.orig 2019-03-02 20:46:28.000000000 +0000
 +++ psutil/arch/netbsd/specific.c
 @@ -22,7 +22,7 @@
@@ -40,3 +43,31 @@
  
  // XXX: This is no longer used as per
  // https://github.com/giampaolo/psutil/pull/557#issuecomment-171912820
+@@ -313,8 +331,8 @@ psutil_get_proc_list(kinfo_proc **procLi
+ char *
+ psutil_get_cmd_args(pid_t pid, size_t *argsize) {
+     int mib[4];
++    int argmax;
+     ssize_t st;
+-    size_t argmax;
+     size_t size;
+     char *procargs = NULL;
+ 
+@@ -339,14 +357,15 @@ psutil_get_cmd_args(pid_t pid, size_t *a
+     mib[2] = pid;
+     mib[3] = KERN_PROC_ARGV;
+ 
+-    st = sysctl(mib, 4, procargs, &argmax, NULL, 0);
++    size = argmax;
++    st = sysctl(mib, 4, procargs, &size, NULL, 0);
+     if (st == -1) {
+         free(procargs);
+         PyErr_SetFromErrno(PyExc_OSError);
+         return NULL;
+     }
+ 
+-    *argsize = argmax;
++    *argsize = size;
+     return procargs;
+ }
+ 



Home | Main Index | Thread Index | Old Index