[hackers] [ubase] util/proc: theoretical underflow || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Sat, 05 Jul 2014 13:00:28 +0200

commit 2557104494c9592c86b545cdf6de8e40f5702da8
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Sat Jul 5 12:51:13 2014 +0000

    util/proc: theoretical underflow

diff --git a/util/proc.c b/util/proc.c
index 84c2a94..d041d5d 100644
--- a/util/proc.c
+++ b/util/proc.c
_AT_@ -43,6 +43,7 @@ parsestat(pid_t pid, struct procstat *ps)
 {
         char path[PATH_MAX];
         FILE *fp;
+ size_t len;
 
         snprintf(path, sizeof(path), "/proc/%d/stat", pid);
         if (!(fp = fopen(path, "r")))
_AT_@ -58,8 +59,10 @@ parsestat(pid_t pid, struct procstat *ps)
                &ps->num_threads, &ps->itrealvalue, &ps->starttime,
                &ps->vsize, &ps->rss, &ps->rsslim);
         /* Filter out '(' and ')' from comm */
- ps->comm[strlen(ps->comm) - 1] = '
Received on Sat Jul 05 2014 - 13:00:28 CEST

This archive was generated by hypermail 2.3.0 : Sat Jul 05 2014 - 13:12:09 CEST