From ad0249f6495d85defa852bd784d13efc55e7800a Mon Sep 17 00:00:00 2001 From: Andrey Vagin Date: Mon, 23 Dec 2013 13:53:53 +0400 Subject: [PATCH] lib: don't copy more than the buffer size CID 1141012 (#1 of 1): Copy into fixed size buffer (STRING_OVERFLOW) 2. fixed_size_dest: You might overrun the 108 byte fixed-size string "addr.sun_path" by copying "service_address" without checking the length. Signed-off-by: Andrey Vagin Signed-off-by: Pavel Emelyanov --- lib/criu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/criu.c b/lib/criu.c index fc7a801dc..42ce7d759 100644 --- a/lib/criu.c +++ b/lib/criu.c @@ -161,7 +161,7 @@ static int criu_connect(void) memset(&addr, 0, sizeof(addr)); addr.sun_family = AF_LOCAL; - strcpy(addr.sun_path, service_address); + strncpy(addr.sun_path, service_address, sizeof(addr.sun_path)); addr_len = strlen(addr.sun_path) + sizeof(addr.sun_family);