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

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