From 8db0374251b72c3fc82367864da178dc842f588b Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 27 Mar 2011 19:41:34 +0200 Subject: s3: Fix Coverity ID 682: NEGATIVE_RETURNS --- libcli/auth/smbencrypt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libcli') diff --git a/libcli/auth/smbencrypt.c b/libcli/auth/smbencrypt.c index 3274f113c2..abd8ad92a3 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); -- cgit