From 481f030ccdc0fc0749f595c1f21b8c7c101387b2 Mon Sep 17 00:00:00 2001 From: Ioana Ciornei Date: Sun, 13 May 2018 16:50:57 +0300 Subject: executor: fix strncpy compile error gcc8 is stricter when dealing with strings and strncpy and demands that the size of the actual string to be copied to be explicitly smaller than the size of the destination, just to make sure the NULL terminator is taken into considerantion. This patch fixes the issue. Signed-off-by: Ioana Ciornei --- pkg/csource/linux_common.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkg/csource/linux_common.go') diff --git a/pkg/csource/linux_common.go b/pkg/csource/linux_common.go index 06fc09137..77ba9b36f 100644 --- a/pkg/csource/linux_common.go +++ b/pkg/csource/linux_common.go @@ -765,7 +765,7 @@ static uintptr_t syz_open_dev(uintptr_t a0, uintptr_t a1, uintptr_t a2) } else { char buf[1024]; char* hash; - NONFAILING(strncpy(buf, (char*)a0, sizeof(buf))); + NONFAILING(strncpy(buf, (char*)a0, sizeof(buf) - 1)); buf[sizeof(buf) - 1] = 0; while ((hash = strchr(buf, '#'))) { *hash = '0' + (char)(a1 % 10); -- cgit mrf-deployment