Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[sfrench/cifs-2.6.git] / fs / cifs / cifsencrypt.c
index 85b31cfa2f3c0042d8b9a77f761cc88be334af4d..d2a05e46d6f52cee5026ea42227291a7cb124597 100644 (file)
@@ -224,7 +224,7 @@ int cifs_verify_signature(struct smb_rqst *rqst,
        if (cifs_pdu->Command == SMB_COM_LOCKING_ANDX) {
                struct smb_com_lock_req *pSMB =
                        (struct smb_com_lock_req *)cifs_pdu;
-           if (pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE)
+               if (pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE)
                        return 0;
        }
 
@@ -304,12 +304,17 @@ int setup_ntlm_response(struct cifs_ses *ses, const struct nls_table *nls_cp)
 int calc_lanman_hash(const char *password, const char *cryptkey, bool encrypt,
                        char *lnm_session_key)
 {
-       int i;
+       int i, len;
        int rc;
        char password_with_pad[CIFS_ENCPWD_SIZE] = {0};
 
-       if (password)
-               strncpy(password_with_pad, password, CIFS_ENCPWD_SIZE);
+       if (password) {
+               for (len = 0; len < CIFS_ENCPWD_SIZE; len++)
+                       if (!password[len])
+                               break;
+
+               memcpy(password_with_pad, password, len);
+       }
 
        if (!encrypt && global_secflags & CIFSSEC_MAY_PLNTXT) {
                memcpy(lnm_session_key, password_with_pad,