diff options
-rw-r--r-- | source4/libcli/util/smbencrypt.c | 6 |
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 |