aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
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;
}