Fixes to minor security bug pointed out by AB in the mount helper
authorSteve French <sfrench@samba.org>
Thu, 26 Feb 2004 06:42:51 +0000 (06:42 +0000)
committerSteve French <sfrench@samba.org>
Thu, 26 Feb 2004 06:42:51 +0000 (06:42 +0000)
source/client/mount.cifs.c

index fa7897fe6643a0d72e4c2030e8f2ac295e672bb8..504de9e629d4f69af1c16d5f518dcdefdb33dc6e 100755 (executable)
@@ -734,9 +734,10 @@ int main(int argc, char ** argv)
 
        if(chdir(mountpoint)) {
                printf("mount error: can not change directory into mount target %s\n",mountpoint);
+               return -1;
        }
 
-       if(stat (mountpoint, &statbuf)) {
+       if(stat (".", &statbuf)) {
                printf("mount error: mount point %s does not exist\n",mountpoint);
                return -1;
        }
@@ -783,6 +784,12 @@ int main(int argc, char ** argv)
                optlen += strlen(mountpassword) + 6;
        options = malloc(optlen + 10);
 
+       if(options == NULL) {
+               printf("Could not allocate memory for mount options\n");
+               return -1;
+       }
+               
+
        options[0] = 0;
        strncat(options,"unc=",4);
        strcat(options,share_name);