summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-02-09 14:45:22 +0000
committerJeremy Allison <jra@samba.org>2000-02-09 14:45:22 +0000
commit2768aecae653929d89d7cd402d953571fe51486e (patch)
tree4df6388792aab1c27f6be26c5e7e7574d43116dc /source3
parent94d68eb8083926738506234163d210e3297b0cac (diff)
downloadsamba-2768aecae653929d89d7cd402d953571fe51486e.tar.gz
samba-2768aecae653929d89d7cd402d953571fe51486e.tar.bz2
samba-2768aecae653929d89d7cd402d953571fe51486e.zip
Defensive programming for cli_error().
Jeremy. (This used to be commit 94ed74d5b09d6f28b47b2855c4e4a1dc5c2108d3)
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/clientgen.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index c510302301..b1d8f8aa73 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -2685,12 +2685,18 @@ void cli_shutdown(struct cli_state *cli)
****************************************************************************/
int cli_error(struct cli_state *cli, uint8 *eclass, uint32 *num, uint32 *nt_rpc_error)
{
- int flgs2 = SVAL(cli->inbuf,smb_flg2);
+ int flgs2;
char rcls;
int code;
if (eclass) *eclass = 0;
if (num ) *num = 0;
+ if (nt_rpc_error) *nt_rpc_error = 0;
+
+ if(!cli || !cli->initialised || !cli->inbuf)
+ return EINVAL;
+
+ flgs2 = SVAL(cli->inbuf,smb_flg2);
if (nt_rpc_error) *nt_rpc_error = cli->nt_error;
if (flgs2 & FLAGS2_32_BIT_ERROR_CODES) {