summaryrefslogtreecommitdiffstats
path: root/source/auth
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
commita7cac639c2cf0e2606d9cfbdb08e961212ee3bfa (patch)
tree95dea1878121007f96df3464ecab68e8f00aaadd /source/auth
parente2361da91f58e123c900f989b0afe94e93387a5d (diff)
downloadsamba-a7cac639c2cf0e2606d9cfbdb08e961212ee3bfa.tar.gz
samba-a7cac639c2cf0e2606d9cfbdb08e961212ee3bfa.tar.xz
samba-a7cac639c2cf0e2606d9cfbdb08e961212ee3bfa.zip
fix overlapping memory bug when copying username
Diffstat (limited to 'source/auth')
-rw-r--r--source/auth/auth_util.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/auth/auth_util.c b/source/auth/auth_util.c
index dfc3f6cc210..f62cc2fb9e0 100644
--- a/source/auth/auth_util.c
+++ b/source/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 */