summaryrefslogtreecommitdiffstats
path: root/source/libsmb/libsmbclient.c
diff options
context:
space:
mode:
authorAlexander Bokovoy <ab@samba.org>2006-03-10 14:39:29 +0000
committerAlexander Bokovoy <ab@samba.org>2006-03-10 14:39:29 +0000
commitbde78b3a3d973df6929ee9a0e0ad3213bd58d4df (patch)
tree9216d3818f1def4d2aa1af951ae6eac0464c37e9 /source/libsmb/libsmbclient.c
parent0908b5eb7ecbb4535988e1dabd2616061fbd564a (diff)
downloadsamba-bde78b3a3d973df6929ee9a0e0ad3213bd58d4df.tar.gz
samba-bde78b3a3d973df6929ee9a0e0ad3213bd58d4df.tar.xz
samba-bde78b3a3d973df6929ee9a0e0ad3213bd58d4df.zip
r14158: Fix coverity CID #147 -- do not dereference pointers before checking their existence
Diffstat (limited to 'source/libsmb/libsmbclient.c')
-rw-r--r--source/libsmb/libsmbclient.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/libsmb/libsmbclient.c b/source/libsmb/libsmbclient.c
index 7cbe4a639b5..7a390a83f21 100644
--- a/source/libsmb/libsmbclient.c
+++ b/source/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,