libcli/smb: fix error checking in smb2_signing_decrypt_pdu() invalid ptext_len
authorStefan Metzmacher <metze@samba.org>
Mon, 31 Jan 2022 19:33:43 +0000 (20:33 +0100)
committerJule Anger <janger@samba.org>
Sun, 13 Feb 2022 09:10:57 +0000 (09:10 +0000)
commit8cf62b3f86f1899e180964b736f3abbe5e5aafd5
tree0bb8340580567594a4a9d99f17b66bcc281e6015
parentd623b454aa8e28408dd4d74c32c82560b75414ba
libcli/smb: fix error checking in smb2_signing_decrypt_pdu() invalid ptext_len

When the ptext_size != m_total check fails, we call this:

   status = gnutls_error_to_ntstatus(rc, NT_STATUS_INTERNAL_ERROR);
   goto out;

As rc is 0 at that point we'll exit smb2_signing_decrypt_pdu()
with NT_STATUS_OK, but without copying the decrypted data
back into the callers buffer. Which leads to strange errors
in the caller.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14968

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 99182af4ab5a3413311e27c2a193e09babceb01c)
libcli/smb/smb2_signing.c