summaryrefslogtreecommitdiffstats
path: root/libcli
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-03-27 19:41:34 +0200
committerVolker Lendecke <vl@samba.org>2011-03-27 22:22:10 +0200
commit8db0374251b72c3fc82367864da178dc842f588b (patch)
tree921d66768dad8cb210cc8c85d8baf7428655be22 /libcli
parent1a1675bbfee01ec2da6874cd3e71ff188ff448fd (diff)
downloadsamba-8db0374251b72c3fc82367864da178dc842f588b.tar.gz
samba-8db0374251b72c3fc82367864da178dc842f588b.tar.xz
samba-8db0374251b72c3fc82367864da178dc842f588b.zip
s3: Fix Coverity ID 682: NEGATIVE_RETURNS
Diffstat (limited to 'libcli')
-rw-r--r--libcli/auth/smbencrypt.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libcli/auth/smbencrypt.c b/libcli/auth/smbencrypt.c
index 3274f113c20..abd8ad92a3c 100644
--- a/libcli/auth/smbencrypt.c
+++ b/libcli/auth/smbencrypt.c
@@ -529,7 +529,7 @@ bool SMBNTLMv2encrypt(TALLOC_CTX *mem_ctx,
bool encode_pw_buffer(uint8_t buffer[516], const char *password, int string_flags)
{
uint8_t new_pw[512];
- size_t new_pw_len;
+ ssize_t new_pw_len;
/* the incoming buffer can be any alignment. */
string_flags |= STR_NOALIGN;
@@ -537,6 +537,9 @@ bool encode_pw_buffer(uint8_t buffer[516], const char *password, int string_flag
new_pw_len = push_string(new_pw,
password,
sizeof(new_pw), string_flags);
+ if (new_pw_len == -1) {
+ return false;
+ }
memcpy(&buffer[512 - new_pw_len], new_pw, new_pw_len);