summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-04-22 06:18:40 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:51:32 -0500
commit2b9fb9618ad8b2b468b0f9961f35a2b0db9d53b5 (patch)
treeaf8d515093adff6006fa2eb22e6283dbf2943cd6 /source4/libcli
parentced7fa4b45adaf2807a5dc84de4fd0dfbcfed55a (diff)
downloadsamba-2b9fb9618ad8b2b468b0f9961f35a2b0db9d53b5.tar.gz
samba-2b9fb9618ad8b2b468b0f9961f35a2b0db9d53b5.tar.bz2
samba-2b9fb9618ad8b2b468b0f9961f35a2b0db9d53b5.zip
r324: - don't reseed on every password generate
- check for overflow (very unlikely) in random buffer generation (This used to be commit 548ec1efefa6f337a362cbadae74f177774e9e29)
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/util/smbencrypt.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/source4/libcli/util/smbencrypt.c b/source4/libcli/util/smbencrypt.c
index a1c026a27d..a091805345 100644
--- a/source4/libcli/util/smbencrypt.c
+++ b/source4/libcli/util/smbencrypt.c
@@ -471,10 +471,13 @@ BOOL encode_pw_buffer(char buffer[516], const char *password, int string_flags)
new_pw_len = push_string(NULL, new_pw,
password,
sizeof(new_pw), string_flags);
+ if (new_pw_len > 512) {
+ return False;
+ }
memcpy(&buffer[512 - new_pw_len], new_pw, new_pw_len);
- generate_random_buffer((unsigned char *)buffer, 512 - new_pw_len, True);
+ generate_random_buffer((unsigned char *)buffer, 512 - new_pw_len, False);
/*
* The length of the new password is in the last 4 bytes of
@@ -485,6 +488,7 @@ BOOL encode_pw_buffer(char buffer[516], const char *password, int string_flags)
return True;
}
+
/***********************************************************
decode a password buffer
*new_pw_len is the length in bytes of the possibly mulitbyte