summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve French <sfrench@samba.org>2004-02-26 06:42:51 +0000
committerSteve French <sfrench@samba.org>2004-02-26 06:42:51 +0000
commita3425dad72dc7e68da39338ff32cd05f3283c00d (patch)
tree1a756c6b5c6c597a14befe126b7d19e6acd97318
parent79d5739893dca1272b60d6566ccb728c73c4240e (diff)
downloadsamba-a3425dad72dc7e68da39338ff32cd05f3283c00d.tar.gz
samba-a3425dad72dc7e68da39338ff32cd05f3283c00d.tar.bz2
samba-a3425dad72dc7e68da39338ff32cd05f3283c00d.zip
Fixes to minor security bug pointed out by AB in the mount helper
(This used to be commit b83802c5a14800554d30c32c12ae3a86e3136bdf)
-rwxr-xr-xsource3/client/mount.cifs.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source3/client/mount.cifs.c b/source3/client/mount.cifs.c
index fa7897fe66..504de9e629 100755
--- a/source3/client/mount.cifs.c
+++ b/source3/client/mount.cifs.c
@@ -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);