1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-17 08:01:36 +00:00

Add a patch to avoid overflows when reading hw.physmem and vfs.bufspace.

Use longs instead of ints, otherwise we risk reporting negative values.

Submitted by:	Axel Gonzalez <loox@e-shell.net>
This commit is contained in:
Raphael Kubo da Costa 2016-02-25 22:26:40 +00:00
parent 36d06b0a1f
commit 0be1a2cc34
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=409564
2 changed files with 22 additions and 0 deletions

View File

@ -2,6 +2,7 @@
PORTNAME= superkaramba
PORTVERSION= ${KDE4_VERSION}
PORTREVISION= 1
CATEGORIES= deskutils kde
MASTER_SITES= KDE/${KDE4_BRANCH}/${PORTVERSION}/src
DIST_SUBDIR= KDE/${PORTVERSION}

View File

@ -0,0 +1,21 @@
Use the right type to avoid overflows and negative values.
--- src/sensors/mem.cpp.orig 2014-09-14 14:15:59 UTC
+++ src/sensors/mem.cpp
@@ -97,7 +97,7 @@ void MemSensor::processExited(K3Process
int MemSensor::getMemTotal()
{
#if defined Q_OS_FREEBSD || defined(Q_OS_NETBSD) || defined(__DragonFly__)
- static int mem = 0;
+ static long mem = 0;
size_t size = sizeof(mem);
sysctlbyname("hw.physmem", &mem, &size, NULL, 0);
@@ -136,7 +136,7 @@ int MemSensor::getMemFree()
int MemSensor::getBuffers()
{
#if defined(Q_OS_FREEBSD) || defined(__DragonFly__)
- static int mem = 0;
+ static long mem = 0;
size_t size = sizeof(mem);
sysctlbyname("vfs.bufspace", &mem, &size, NULL, 0);