summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2004-03-16 20:28:47 +0000
committerGerald Carter <jerry@samba.org>2004-03-16 20:28:47 +0000
commitc340b2e5e49c14c2e8377234b399f0682c7e3d5a (patch)
tree1ea6676aa22d27b619cdeb57716cd2a22a76d941 /source3
parent107ddbdc6ed0632e54eeb597f6fafe82f4662a1a (diff)
downloadsamba-c340b2e5e49c14c2e8377234b399f0682c7e3d5a.tar.gz
samba-c340b2e5e49c14c2e8377234b399f0682c7e3d5a.tar.bz2
samba-c340b2e5e49c14c2e8377234b399f0682c7e3d5a.zip
fix overlapping memory bug when copying username
(This used to be commit a7cac639c2cf0e2606d9cfbdb08e961212ee3bfa)
Diffstat (limited to 'source3')
-rw-r--r--source3/auth/auth_util.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c
index dfc3f6cc21..f62cc2fb9e 100644
--- a/source3/auth/auth_util.c
+++ b/source3/auth/auth_util.c
@@ -973,6 +973,7 @@ struct passwd *smb_getpwnam( char *domuser, fstring save_username, BOOL create )
struct passwd *pw = NULL;
char *p;
fstring mapped_username;
+ fstring strip_username;
/* we only save a copy of the username it has been mangled
by winbindd use default domain */
@@ -1010,9 +1011,11 @@ struct passwd *smb_getpwnam( char *domuser, fstring save_username, BOOL create )
}
/* setup for lookup of just the username */
- p++;
- fstrcpy( mapped_username, p );
+ /* remember that p and mapped_username are overlapping memory */
+ p++;
+ fstrcpy( strip_username, p );
+ fstrcpy( mapped_username, strip_username );
}
/* just lookup a plain username */