r16250: Fix Klokwork IDs 148, 151, 152, 154.
authorVolker Lendecke <vlendec@samba.org>
Thu, 15 Jun 2006 11:17:57 +0000 (11:17 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:17:28 +0000 (11:17 -0500)
Volker
(This used to be commit d7a75ee94db009085165c062f73b68162a8b6da8)

source3/client/client.c

index aa25d9aba5bf25da827e8aef6935103570a74167..c1ff1151c0e1cd68c510141fd9f1ca48bd9efbc5 100644 (file)
@@ -269,7 +269,7 @@ static int do_cd(char *newdir)
        else
                pstrcat(cur_dir,p);
 
-       if (*(cur_dir+strlen(cur_dir)-1) != '\\') {
+       if ((cur_dir[0] != '\0') && (*(cur_dir+strlen(cur_dir)-1) != '\\')) {
                pstrcat(cur_dir, "\\");
        }
        
@@ -647,7 +647,7 @@ static int cmd_dir(void)
        dir_total = 0;
        if (strcmp(cur_dir, "\\") != 0) {
                pstrcpy(mask,cur_dir);
-               if(mask[strlen(mask)-1]!='\\')
+               if ((mask[0] != '\0') && (mask[strlen(mask)-1]!='\\'))
                        pstrcat(mask,"\\");
        } else {
                pstrcpy(mask, "\\");
@@ -686,7 +686,7 @@ static int cmd_du(void)
        
        dir_total = 0;
        pstrcpy(mask,cur_dir);
-       if(mask[strlen(mask)-1]!='\\')
+       if ((mask[0] != '\0') && (mask[strlen(mask)-1]!='\\'))
                pstrcat(mask,"\\");
        
        if (next_token_nr(NULL,buf,NULL,sizeof(buf))) {
@@ -1008,7 +1008,7 @@ static int cmd_mget(void)
 
        while (next_token_nr(NULL,p,NULL,sizeof(buf))) {
                pstrcpy(mget_mask,cur_dir);
-               if(mget_mask[strlen(mget_mask)-1]!='\\')
+               if ((mask[0] != '\0') && (mget_mask[strlen(mget_mask)-1]!='\\'))
                        pstrcat(mget_mask,"\\");
                
                if (*p == '\\')