From cfe751ef9fa05b19ec70d4314718d1b3df23f38c Mon Sep 17 00:00:00 2001 From: Qu Chen Date: Sat, 13 Aug 2022 12:27:07 -0700 Subject: Do memory bound check for some C string operations --- linux_priv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux_priv.c') diff --git a/linux_priv.c b/linux_priv.c index a8283db..8d132c8 100644 --- a/linux_priv.c +++ b/linux_priv.c @@ -49,7 +49,7 @@ static const struct sigaction act = { void setup_privilege_violations_handler(void) { kill_msg = malloc(strlen(KILL_MSG_STR)+1); - strcpy(kill_msg, KILL_MSG_STR); + strncpy(kill_msg, KILL_MSG_STR, strlen(KILL_MSG_STR)+1); sigaction(SIGSYS, &act, NULL); } -- cgit v1.2.1