From c340b2e5e49c14c2e8377234b399f0682c7e3d5a Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 16 Mar 2004 20:28:47 +0000 Subject: [PATCH] fix overlapping memory bug when copying username (This used to be commit a7cac639c2cf0e2606d9cfbdb08e961212ee3bfa) --- source3/auth/auth_util.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c index dfc3f6cc210..f62cc2fb9e0 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 */ -- 2.11.4.GIT