libwbclient: Actually copy something in wbcChangeUserPasswordEx
authorVolker Lendecke <vl@samba.org>
Fri, 23 Apr 2010 17:41:29 +0000 (19:41 +0200)
committerVolker Lendecke <vl@samba.org>
Fri, 23 Apr 2010 21:41:04 +0000 (23:41 +0200)
The length argument for memcpy was initialized to 0 and not initialized

nsswitch/libwbclient/wbc_pam.c

index 30325c85c26f1abf01e6271d31415fd94e318d17..50524d2169b658d2a77752867c006f3da5855dcf 100644 (file)
@@ -899,35 +899,35 @@ wbcErr wbcChangeUserPasswordEx(const struct wbcChangePasswordParams *params,
                        sizeof(request.data.chng_pswd_auth_crap.domain) - 1);
 
                if (params->new_password.response.nt_data) {
+                       request.data.chng_pswd_auth_crap.new_nt_pswd_len =
+                               params->new_password.response.nt_length;
                        memcpy(request.data.chng_pswd_auth_crap.new_nt_pswd,
                               params->new_password.response.nt_data,
                               request.data.chng_pswd_auth_crap.new_nt_pswd_len);
-                       request.data.chng_pswd_auth_crap.new_nt_pswd_len =
-                               params->new_password.response.nt_length;
                }
 
                if (params->new_password.response.lm_data) {
+                       request.data.chng_pswd_auth_crap.new_lm_pswd_len =
+                               params->new_password.response.lm_length;
                        memcpy(request.data.chng_pswd_auth_crap.new_lm_pswd,
                               params->new_password.response.lm_data,
                               request.data.chng_pswd_auth_crap.new_lm_pswd_len);
-                       request.data.chng_pswd_auth_crap.new_lm_pswd_len =
-                               params->new_password.response.lm_length;
                }
 
                if (params->old_password.response.old_nt_hash_enc_data) {
+                       request.data.chng_pswd_auth_crap.old_nt_hash_enc_len =
+                               params->old_password.response.old_nt_hash_enc_length;
                        memcpy(request.data.chng_pswd_auth_crap.old_nt_hash_enc,
                               params->old_password.response.old_nt_hash_enc_data,
                               request.data.chng_pswd_auth_crap.old_nt_hash_enc_len);
-                       request.data.chng_pswd_auth_crap.old_nt_hash_enc_len =
-                               params->old_password.response.old_nt_hash_enc_length;
                }
 
                if (params->old_password.response.old_lm_hash_enc_data) {
+                       request.data.chng_pswd_auth_crap.old_lm_hash_enc_len =
+                               params->old_password.response.old_lm_hash_enc_length;
                        memcpy(request.data.chng_pswd_auth_crap.old_lm_hash_enc,
                               params->old_password.response.old_lm_hash_enc_data,
                               request.data.chng_pswd_auth_crap.old_lm_hash_enc_len);
-                       request.data.chng_pswd_auth_crap.old_lm_hash_enc_len =
-                               params->old_password.response.old_lm_hash_enc_length;
                }
 
                break;