Author: ab
Date: 2006-03-10 14:39:59 +0000 (Fri, 10 Mar 2006)
New Revision: 14159

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=14159

Log:
Fix coverity CID #147 -- do not dereference pointers before checking their 
existence
Modified:
   trunk/source/libsmb/libsmbclient.c


Changeset:
Modified: trunk/source/libsmb/libsmbclient.c
===================================================================
--- trunk/source/libsmb/libsmbclient.c  2006-03-10 14:39:29 UTC (rev 14158)
+++ trunk/source/libsmb/libsmbclient.c  2006-03-10 14:39:59 UTC (rev 14159)
@@ -1282,8 +1282,8 @@
        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 @@
 
        }
 
+        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,

Reply via email to