From 1eaae6526be3340688a8cfbcc1aec314fd613730 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Thu, 28 Jun 2018 13:42:58 +0200 Subject: [PATCH] pkcs15-tool: Build with current gcc The argument to strncpy is not the length of the target buffer, but the source one (excluding the null byte, which will be copied anyway). --- src/tools/pkcs15-tool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/pkcs15-tool.c b/src/tools/pkcs15-tool.c index 33161357..019ab8c0 100644 --- a/src/tools/pkcs15-tool.c +++ b/src/tools/pkcs15-tool.c @@ -1022,7 +1022,7 @@ static int read_ssh_key(void) buf[1] = 0; buf[2] = 0; len = snprintf((char *) buf+4, 20, "ecdsa-sha2-nistp%d", n); - strncpy(alg, (char *) buf+4, 20); + strncpy(alg, (char *) buf+4, 19); buf[3] = len; len += 4;