From: Mike Frysinger Date: Sun, 20 May 2012 10:22:01 +0000 (-0400) Subject: skill: check return value of getline X-Git-Tag: v3.3.4~71 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c6e3ec4602bd92d94ec728702f09c8bf749bb826;p=procps-ng skill: check return value of getline Signed-off-by: Mike Frysinger --- diff --git a/skill.c b/skill.c index 791cfa05..94bf9c93 100644 --- a/skill.c +++ b/skill.c @@ -98,7 +98,8 @@ static void hurt_proc(int tty, int uid, int pid, const char *restrict const cmd, fprintf(stderr, "%-8s %-8s %5d %-16.16s ? ", (char *)dn_buf, user_from_uid(uid), pid, cmd); fflush (stdout); - getline(&buf, &len, stdin); + if (getline(&buf, &len, stdin) == -1) + return; if (rpmatch(buf) < 1) { free(buf); return;