Skip to content

Commit

Permalink
Merge pull request #35 from mattthias/master
Browse files Browse the repository at this point in the history
Read enough bytes to avoid output truncation
  • Loading branch information
steveschnepp authored Oct 23, 2017
2 parents e57873a + 08016ca commit 8cfe354
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/plugins/threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

int threads(int argc, char **argv) {
FILE *f;
char buff[512]; /* normally only 256 char are used, but gcc complains when sprintf %s is used */
char buff[270];
const char *s;
int i, sum;
DIR *d;
Expand Down Expand Up @@ -59,7 +59,7 @@ int threads(int argc, char **argv) {
break;
if(*s) /* non-digit found */
continue;
snprintf(buff, 256, "/proc/%s/status", e->d_name);
snprintf(buff, 270, "/proc/%s/status", e->d_name);
if(!(f = fopen(buff, "r")))
continue; /* process has vanished */
while(fgets(buff, 256, f)) {
Expand Down

0 comments on commit 8cfe354

Please sign in to comment.