diff --git a/pgrep.c b/pgrep.c index 58a8842b..4b64c1a1 100644 --- a/pgrep.c +++ b/pgrep.c @@ -588,8 +588,9 @@ static struct el * select_procs (int *num) match = match_strlist (tty, opt_term); } } - else if (opt_older) + else if (opt_older) { if(now - uptime_secs + (task.start_time / Hertz) + opt_older > now) match = 0; + } else if (opt_runstates) { match = 0; if (strchr(opt_runstates, task.state)) match = 1; diff --git a/proc/sysinfo.c b/proc/sysinfo.c index 4b2090be..5daa70b2 100644 --- a/proc/sysinfo.c +++ b/proc/sysinfo.c @@ -488,7 +488,7 @@ static void getrunners(unsigned int *restrict running, unsigned int *restrict bl char c; if (!isdigit(ent->d_name[0])) continue; - sprintf(tbuf, "/proc/%s/stat", ent->d_name); + snprintf(tbuf, sizeof(tbuf), "/proc/%s/stat", ent->d_name); fd = open(tbuf, O_RDONLY, 0); if (fd == -1) continue;