From ce53430263cd3d8f2bd4dc746ba6fa35a74834ed Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Fri, 10 Mar 2006 14:39:29 +0000 Subject: r14158: Fix coverity CID #147 -- do not dereference pointers before checking their existence (This used to be commit 6b52423033b2eccdfad1e91e9d59619664f570ac) --- source3/libsmb/libsmbclient.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source3/libsmb') diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c index 7cbe4a639b..7a390a83f2 100644 --- a/source3/libsmb/libsmbclient.c +++ b/source3/libsmb/libsmbclient.c @@ -1282,8 +1282,8 @@ smbc_write_ctx(SMBCCTX *context, pstring path, targetpath; struct cli_state *targetcli; - offset = file->offset; /* See "offset" comment in smbc_read_ctx() */ - + /* First check all pointers before dereferencing them */ + if (!context || !context->internal || !context->internal->_initialized) { @@ -1308,6 +1308,8 @@ smbc_write_ctx(SMBCCTX *context, } + offset = file->offset; /* See "offset" comment in smbc_read_ctx() */ + /*d_printf(">>>write: parsing %s\n", file->fname);*/ if (smbc_parse_path(context, file->fname, NULL, 0, -- cgit