summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2004-04-10 19:24:31 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:51:11 -0500
commitb81b4711f764d10c19b6a01aadcf6e945cb0c450 (patch)
tree360e7762c4763712355447851ead26b1b88f75bf
parent69a91df4ed4fc8a8d2105d098e4572e6c0da5ebb (diff)
downloadsamba-b81b4711f764d10c19b6a01aadcf6e945cb0c450.tar.gz
samba-b81b4711f764d10c19b6a01aadcf6e945cb0c450.tar.bz2
samba-b81b4711f764d10c19b6a01aadcf6e945cb0c450.zip
r148: Ensure we do not dereference a null pointer when we return the user
session key. (This used to be commit b09d333aed00a7ea599f45105e913d3a3ea25b31)
-rw-r--r--source3/libsmb/ntlm_check.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/source3/libsmb/ntlm_check.c b/source3/libsmb/ntlm_check.c
index a7764f9e98..1d02b03e0c 100644
--- a/source3/libsmb/ntlm_check.c
+++ b/source3/libsmb/ntlm_check.c
@@ -330,7 +330,9 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
uint8 first_8_lm_hash[16];
memcpy(first_8_lm_hash, lm_pw, 8);
memset(first_8_lm_hash + 8, '\0', 8);
- *lm_sess_key = data_blob(first_8_lm_hash, 16);
+ if (lm_sess_key) {
+ *lm_sess_key = data_blob(first_8_lm_hash, 16);
+ }
}
return NT_STATUS_OK;
} else {
@@ -371,8 +373,13 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
uint8 first_8_lm_hash[16];
memcpy(first_8_lm_hash, lm_pw, 8);
memset(first_8_lm_hash + 8, '\0', 8);
- *user_sess_key = data_blob(first_8_lm_hash, 16);
- *lm_sess_key = data_blob(first_8_lm_hash, 16);
+ if (user_sess_key) {
+ *user_sess_key = data_blob(first_8_lm_hash, 16);
+ }
+
+ if (lm_sess_key) {
+ *lm_sess_key = data_blob(first_8_lm_hash, 16);
+ }
return NT_STATUS_OK;
}
}
@@ -431,8 +438,13 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
uint8 first_8_lm_hash[16];
memcpy(first_8_lm_hash, lm_pw, 8);
memset(first_8_lm_hash + 8, '\0', 8);
- *user_sess_key = data_blob(first_8_lm_hash, 16);
- *lm_sess_key = data_blob(first_8_lm_hash, 16);
+ if (user_sess_key) {
+ *user_sess_key = data_blob(first_8_lm_hash, 16);
+ }
+
+ if (lm_sess_key) {
+ *lm_sess_key = data_blob(first_8_lm_hash, 16);
+ }
}
return NT_STATUS_OK;
}