r14158: Fix coverity CID #147 -- do not dereference pointers before checking their...
authorAlexander Bokovoy <ab@samba.org>
Fri, 10 Mar 2006 14:39:29 +0000 (14:39 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:15:14 +0000 (11:15 -0500)
(This used to be commit 6b52423033b2eccdfad1e91e9d59619664f570ac)

source3/libsmb/libsmbclient.c

index 7cbe4a639b5e571d2404fc08b38c8af24f89fb65..7a390a83f21af0ab97f93d7b7fb3d1592bc3e75a 100644 (file)
@@ -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,