Blame SOURCES/cyrus-sasl-2.1.27-nostrncpy.patch

8b8af0
diff --git a/plugins/gssapi.c b/plugins/gssapi.c
8b8af0
index 5d900c5e..4688bb9a 100644
8b8af0
--- a/plugins/gssapi.c
8b8af0
+++ b/plugins/gssapi.c
8b8af0
@@ -1567,7 +1567,6 @@ int gssapiv2_server_plug_init(
8b8af0
 {
8b8af0
 #ifdef HAVE_GSSKRB5_REGISTER_ACCEPTOR_IDENTITY
8b8af0
     const char *keytab = NULL;
8b8af0
-    char keytab_path[1024];
8b8af0
     unsigned int rl;
8b8af0
 #endif
8b8af0
     
8b8af0
@@ -1589,15 +1588,7 @@ int gssapiv2_server_plug_init(
8b8af0
 	    return SASL_FAIL;
8b8af0
 	}
8b8af0
 	
8b8af0
-	if(strlen(keytab) > 1024) {
8b8af0
-	    utils->log(NULL, SASL_LOG_ERR,
8b8af0
-		       "path to keytab is > 1024 characters");
8b8af0
-	    return SASL_BUFOVER;
8b8af0
-	}
8b8af0
-	
8b8af0
-	strncpy(keytab_path, keytab, 1024);
8b8af0
-	
8b8af0
-	gsskrb5_register_acceptor_identity(keytab_path);
8b8af0
+	gsskrb5_register_acceptor_identity(keytab);
8b8af0
     }
8b8af0
 #endif
8b8af0
     
8b8af0
diff --git a/plugins/ntlm.c b/plugins/ntlm.c
8b8af0
index aeb3ac34..8a7d9065 100644
8b8af0
--- a/plugins/ntlm.c
8b8af0
+++ b/plugins/ntlm.c
8b8af0
@@ -375,10 +375,15 @@ static unsigned char *P16_lm(unsigned char *P16, sasl_secret_t *passwd,
8b8af0
 			     unsigned *buflen __attribute__((unused)),
8b8af0
 			     int *result)
8b8af0
 {
8b8af0
-    char P14[14];
8b8af0
+    char P14[14] = { 0 };
8b8af0
+    int Plen;
8b8af0
     unsigned char S8[] = { 0x4b, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 };
8b8af0
 
8b8af0
-    strncpy(P14, (const char *) passwd->data, sizeof(P14));
8b8af0
+    Plen = sizeof(P14);
8b8af0
+    if (passwd->len < Plen) {
8b8af0
+        Plen = passwd->len;
8b8af0
+    }
8b8af0
+    memcpy(P14, (const char *) passwd->data, Plen);
8b8af0
     ucase(P14, sizeof(P14));
8b8af0
 
8b8af0
     E(P16, (unsigned char *) P14, sizeof(P14), S8, sizeof(S8));