From e35c3fcc6ebe2945bcf695cb9d3eeaa2460ecb04 Mon Sep 17 00:00:00 2001 From: landley Date: Tue, 27 Jun 2006 18:14:12 +0000 Subject: Fix http://bugs.busybox.net/view.php?id=906 which could cause failures in top. git-svn-id: svn://busybox.net/trunk/busybox@15532 69ca8d6d-28ef-0310-b511-8ec308f3f277 --- libbb/procps.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; } -- cgit v1.2.3-55-g6feb