commit | 22f383e6954eed73781695f52093a6d4a120d475 | [log] [tgz] |
---|---|---|
author | Rob Landley <rob@landley.net> | Tue Jun 27 18:14:12 2006 +0000 |
committer | Rob Landley <rob@landley.net> | Tue Jun 27 18:14:12 2006 +0000 |
tree | 3234b5686b4f3ed15a2c5322c722d860484ab063 | |
parent | 21302c2b789352d9ab741f91c1ac2e4f5cd71c68 [diff] |
Fix http://bugs.busybox.net/view.php?id=906 which could cause failures in top.
diff --git a/libbb/procps.c b/libbb/procps.c index b483a32..85549c9 100644 --- a/libbb/procps.c +++ b/libbb/procps.c
@@ -28,7 +28,8 @@ 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; }