summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAlexander Bokovoy <ab@samba.org>2006-03-10 14:39:29 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:15:14 -0500
commitce53430263cd3d8f2bd4dc746ba6fa35a74834ed (patch)
tree52bfdf1a9b3c4b25ff0e1c4c7cb741251f652a6f /source3
parenta5eda886778fe22b15f973236b3b133e78308148 (diff)
downloadsamba-ce53430263cd3d8f2bd4dc746ba6fa35a74834ed.tar.gz
samba-ce53430263cd3d8f2bd4dc746ba6fa35a74834ed.tar.bz2
samba-ce53430263cd3d8f2bd4dc746ba6fa35a74834ed.zip
r14158: Fix coverity CID #147 -- do not dereference pointers before checking their existence
(This used to be commit 6b52423033b2eccdfad1e91e9d59619664f570ac)
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/libsmbclient.c6
1 files changed, 4 insertions, 2 deletions
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,