w: stale utmp entries snuck in via uninitialized var -- thanks Robert A Basch

This commit is contained in:
albert 2006-06-17 06:14:33 +00:00
parent 89ed9ba210
commit 87eb7ec462
2 changed files with 2 additions and 1 deletions

1
NEWS
View File

@ -8,6 +8,7 @@ ps: fix s format (signals) output with thread display
watch: avoid integer overflow for the time delay watch: avoid integer overflow for the time delay
pwdx: buffer overflow fixed -- thanks Ulf Harnhammar pwdx: buffer overflow fixed -- thanks Ulf Harnhammar
procps.spec needed a slash -- thanks Jesse Brandeburg procps.spec needed a slash -- thanks Jesse Brandeburg
w: stale utmp entries snuck in via uninitialized var -- thanks Robert A Basch
procps-3.2.5 --> procps-3.2.6 procps-3.2.5 --> procps-3.2.6

2
w.c
View File

@ -132,6 +132,7 @@ static const proc_t *getproc(const utmp_t *restrict const u, const char *restric
const proc_t *secondbest = NULL; const proc_t *secondbest = NULL;
unsigned uid = ~0U; unsigned uid = ~0U;
*found_utpid = 0;
if(!ignoreuser){ if(!ignoreuser){
char buf[UT_NAMESIZE+1]; char buf[UT_NAMESIZE+1];
struct passwd *passwd_data; /* pointer to static data */ struct passwd *passwd_data; /* pointer to static data */
@ -144,7 +145,6 @@ static const proc_t *getproc(const utmp_t *restrict const u, const char *restric
} }
line = tty_to_dev(tty); line = tty_to_dev(tty);
*jcpu = 0; *jcpu = 0;
*found_utpid = 0;
for(; *pptr; pptr++) { for(; *pptr; pptr++) {
const proc_t *restrict const tmp = *pptr; const proc_t *restrict const tmp = *pptr;
if(unlikely(tmp->tgid == u->ut_pid)) { if(unlikely(tmp->tgid == u->ut_pid)) {