From 7367c4b1fd34348afa01f7b2663344cdb1075ad0 Mon Sep 17 00:00:00 2001 From: Qualys Security Advisory Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH] skill: Do not scan past the null-terminator in check_proc(). --- skill.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/skill.c b/skill.c index edc42053..3bc331f6 100644 --- a/skill.c +++ b/skill.c @@ -209,8 +209,11 @@ static void check_proc(int pid, struct run_time_conf_t *run_time) *tmp++ = '\0'; i = 5; while (i--) - while (*tmp++ != ' ') - /* scan to find tty */ ; + do { + if (!*tmp) + goto closure; + /* scan to find tty */ + } while (*tmp++ != ' '); tty = atoi(tmp); if (ttys) { i = tty_count;