summaryrefslogtreecommitdiffstats
path: root/source/libsmb/clientgen.c
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
commit94ed74d5b09d6f28b47b2855c4e4a1dc5c2108d3 (patch)
treed8f6a9e74b2ab148de984ebd6a6ac691f43f2e24 /source/libsmb/clientgen.c
parent3609e835d4f938190f43b958403978c892b4bc9b (diff)
downloadsamba-94ed74d5b09d6f28b47b2855c4e4a1dc5c2108d3.tar.gz
samba-94ed74d5b09d6f28b47b2855c4e4a1dc5c2108d3.tar.xz
samba-94ed74d5b09d6f28b47b2855c4e4a1dc5c2108d3.zip
Defensive programming for cli_error().
Jeremy.
Diffstat (limited to 'source/libsmb/clientgen.c')
-rw-r--r--source/libsmb/clientgen.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source/libsmb/clientgen.c b/source/libsmb/clientgen.c
index c510302301a..b1d8f8aa73f 100644
--- a/source/libsmb/clientgen.c
+++ b/source/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) {