From d710b7273da0f6ac8d4ed4c9c9d38f5feb1dba3d Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Tue, 11 Jan 2011 20:57:25 -0500 Subject: [PATCH] kill.so: use a safer strncat(). --- contrib/kill.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/kill.c b/contrib/kill.c index 7721f5d..2a88232 100644 --- a/contrib/kill.c +++ b/contrib/kill.c @@ -205,8 +205,8 @@ int ui_module_exec(char ***result, const struct passwd *pw, const int char *s = "!"; if (isdigit(*tmp) == 0) { - strncat(line, "!", sizeof(line)); - strncat(line, m, sizeof(line)); + strncat(line, "!", sizeof(line)-strlen(line)-1); + strncat(line, m, sizeof(line)-strlen(line)-1); } else { pid = atol(tmp); @@ -220,8 +220,8 @@ int ui_module_exec(char ***result, const struct passwd *pw, const int s = "0"; } - strncat(line, s, sizeof(line)); - strncat(line, m, sizeof(line)); + strncat(line, s, sizeof(line)-strlen(line)-1); + strncat(line, m, sizeof(line)-strlen(line)-1); } } } -- 2.11.4.GIT