aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-06-27 18:14:12 +0000
committerRob Landley <rob@landley.net>2006-06-27 18:14:12 +0000
commit22f383e6954eed73781695f52093a6d4a120d475 (patch)
tree3234b5686b4f3ed15a2c5322c722d860484ab063 /libbb
parent21302c2b789352d9ab741f91c1ac2e4f5cd71c68 (diff)
downloadbusybox-22f383e6954eed73781695f52093a6d4a120d475.tar.gz
Fix http://bugs.busybox.net/view.php?id=906 which could cause failures in top.
Diffstat (limited to 'libbb')
-rw-r--r--libbb/procps.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libbb/procps.c b/libbb/procps.c
index b483a326c..85549c995 100644
--- a/libbb/procps.c
+++ b/libbb/procps.c
@@ -28,7 +28,8 @@ static int read_to_buf(const char *filename, void *buf)
fd = open(filename, O_RDONLY);
if(fd < 0)
return -1;
- ret = read(fd, buf, PROCPS_BUFSIZE);
+ ret = read(fd, buf, PROCPS_BUFSIZE-1);
+ ((char *)buf)[ret > 0 ? ret : 0] = 0;
close(fd);
return ret;
}