summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralxchk <alxchk@gmail.com>2018-10-11 13:15:08 +0300
committerGiampaolo Rodola <g.rodola@gmail.com>2018-10-11 12:15:08 +0200
commita7900080aed852598776cd3b6c8408c117160e8d (patch)
tree3edbf5efe6a2bfea4fc888f1044a2c1e1c9dea87
parent33b7c7a7574c288c17265661d96e9f557f168aaa (diff)
downloadpsutil-a7900080aed852598776cd3b6c8408c117160e8d.tar.gz
Fix https://github.com/giampaolo/psutil/issues/1346 (#1347)
-rw-r--r--psutil/_psutil_sunos.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/psutil/_psutil_sunos.c b/psutil/_psutil_sunos.c
index 99069f56..0717f195 100644
--- a/psutil/_psutil_sunos.c
+++ b/psutil/_psutil_sunos.c
@@ -1173,7 +1173,7 @@ psutil_net_connections(PyObject *self, PyObject *args) {
mibhdr.len = 0;
#endif
memcpy(buf, &tor, sizeof tor);
- memcpy(buf + sizeof tor, &mibhdr, sizeof mibhdr);
+ memcpy(buf + tor.OPT_offset, &mibhdr, sizeof mibhdr);
ctlbuf.buf = buf;
ctlbuf.len = tor.OPT_offset + tor.OPT_length;
@@ -1213,6 +1213,9 @@ psutil_net_connections(PyObject *self, PyObject *args) {
goto error;
}
+ memset(&mibhdr, 0x0, sizeof(mibhdr));
+ memcpy(&mibhdr, buf + toa.OPT_offset, toa.OPT_length);
+
databuf.maxlen = mibhdr.len;
databuf.len = 0;
databuf.buf = (char *)malloc((int)mibhdr.len);