Blame SOURCES/libkcapi-1.1.1-test_Be_sure_to_terminate_strncpy_copied_string.patch

b09f25
From a10e5ff7f8f69e1ed5cd4151f3e71f4783c40c68 Mon Sep 17 00:00:00 2001
b09f25
From: Krzysztof Kozlowski <krzk@kernel.org>
b09f25
Date: Thu, 12 Jul 2018 18:13:32 +0200
b09f25
Subject: [PATCH] test: Be sure to terminate strncpy() copied string
b09f25
 (-Wstringop-truncation)
b09f25
b09f25
strncpy() might not NULL-terminate the buffer.  This fixes GCC v8.1.0 warning:
b09f25
b09f25
    test/kcapi-main.c: In function 'main':
b09f25
    test/kcapi-main.c:3123:5: error: 'strncpy' specified bound 63 equals destination size [-Werror=stringop-truncation]
b09f25
         strncpy(cavs_test.cipher, optarg,
b09f25
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
b09f25
          CIPHERMAXNAME);
b09f25
          ~~~~~~~~~~~~~~
b09f25
b09f25
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
b09f25
Signed-off-by: Stephan Mueller <smueller@chronox.de>
b09f25
---
b09f25
 test/kcapi-main.c | 2 +-
b09f25
 1 file changed, 1 insertion(+), 1 deletion(-)
b09f25
b09f25
diff --git a/test/kcapi-main.c b/test/kcapi-main.c
b09f25
index 8352499..c167b7f 100644
b09f25
--- a/test/kcapi-main.c
b09f25
+++ b/test/kcapi-main.c
b09f25
@@ -3121,7 +3121,7 @@ int main(int argc, char *argv[])
b09f25
 				break;
b09f25
 			case 'c':
b09f25
 				strncpy(cavs_test.cipher, optarg,
b09f25
-					CIPHERMAXNAME);
b09f25
+					CIPHERMAXNAME - 1);
b09f25
 				break;
b09f25
 			case 'p':
b09f25
 				len = strlen(optarg);