Blame SOURCES/0042-Revert-Revert-CRYPTO-Suppress-warning-Wstringop-trun.patch

ca1eb8
From 503172f46360b33170063b3bf75047990c644ed5 Mon Sep 17 00:00:00 2001
ca1eb8
From: Lukas Slebodnik <lslebodn@redhat.com>
ca1eb8
Date: Tue, 31 Jul 2018 20:43:37 +0000
ca1eb8
Subject: [PATCH] Revert "Revert "CRYPTO: Suppress warning
ca1eb8
 Wstringop-truncation""
ca1eb8
ca1eb8
This reverts commit bb20d5160faed5e0076887ac4a83e550be15a8b2.
ca1eb8
ca1eb8
The patch introduced compile time warning
ca1eb8
src/util/crypto/libcrypto/crypto_sha512crypt.c:280:10: error: 'stpncpy'
ca1eb8
    output truncated before terminating nul copying 3 bytes from a string
ca1eb8
    of the same length [-Werror=stringop-truncation]
ca1eb8
     cp = stpncpy(buffer, sha512_salt_prefix, SALT_PREF_SIZE);
ca1eb8
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ca1eb8
ca1eb8
Merges: https://pagure.io/SSSD/sssd/pull-request/3792
ca1eb8
ca1eb8
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
ca1eb8
---
ca1eb8
 src/util/crypto/libcrypto/crypto_sha512crypt.c | 2 +-
ca1eb8
 src/util/crypto/nss/nss_sha512crypt.c          | 2 +-
ca1eb8
 2 files changed, 2 insertions(+), 2 deletions(-)
ca1eb8
ca1eb8
diff --git a/src/util/crypto/libcrypto/crypto_sha512crypt.c b/src/util/crypto/libcrypto/crypto_sha512crypt.c
ca1eb8
index b074eee555fafac6e486bfdf9efb9ddf4964a990..5861f34b9325f7552491a07e8b85fe35ca5ae607 100644
ca1eb8
--- a/src/util/crypto/libcrypto/crypto_sha512crypt.c
ca1eb8
+++ b/src/util/crypto/libcrypto/crypto_sha512crypt.c
ca1eb8
@@ -277,7 +277,7 @@ static int sha512_crypt_r(const char *key,
ca1eb8
         goto done;
ca1eb8
     }
ca1eb8
 
ca1eb8
-    cp = stpncpy(buffer, sha512_salt_prefix, SALT_PREF_SIZE);
ca1eb8
+    cp = memcpy(buffer, sha512_salt_prefix, SALT_PREF_SIZE);
ca1eb8
     buflen -= SALT_PREF_SIZE;
ca1eb8
 
ca1eb8
     if (rounds_custom) {
ca1eb8
diff --git a/src/util/crypto/nss/nss_sha512crypt.c b/src/util/crypto/nss/nss_sha512crypt.c
ca1eb8
index 2f1624e6396c40f539a4e2034ab545cad8f05434..709cf51961bb7069ddebf3d636aa29b020756f0a 100644
ca1eb8
--- a/src/util/crypto/nss/nss_sha512crypt.c
ca1eb8
+++ b/src/util/crypto/nss/nss_sha512crypt.c
ca1eb8
@@ -267,7 +267,7 @@ static int sha512_crypt_r(const char *key,
ca1eb8
         goto done;
ca1eb8
     }
ca1eb8
 
ca1eb8
-    cp = stpncpy(buffer, sha512_salt_prefix, SALT_PREF_SIZE);
ca1eb8
+    cp = memcpy(buffer, sha512_salt_prefix, SALT_PREF_SIZE);
ca1eb8
     buflen -= SALT_PREF_SIZE;
ca1eb8
 
ca1eb8
     if (rounds_custom) {
ca1eb8
-- 
ca1eb8
2.14.4
ca1eb8