diff options
author | Jeremy Allison <jra@samba.org> | 2009-12-21 21:16:15 -0800 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2010-01-13 14:01:05 +0100 |
commit | ff8ab11dacb7e4f4c2cba76af46de88f24336309 (patch) | |
tree | 039150f96b06a64dd82c5c76c5fd092692801438 /source | |
parent | 9aab74eaca37b49ad9453d64ede85651f56280b6 (diff) | |
download | samba-ff8ab11dacb7e4f4c2cba76af46de88f24336309.tar.gz samba-ff8ab11dacb7e4f4c2cba76af46de88f24336309.tar.xz samba-ff8ab11dacb7e4f4c2cba76af46de88f24336309.zip |
Fix bug 7005 - mangle method = hash truncates files with dot '. ' character
Don't change the contents of a const string via a pointer
alias (or if you do, change it back.....).
Jeremy.
(cherry picked from commit e3be5ddae764fae7ff4a3ef502e8461d0535bdc5)
Diffstat (limited to 'source')
-rw-r--r-- | source/smbd/mangle_hash.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/smbd/mangle_hash.c b/source/smbd/mangle_hash.c index 5de69e21ab4..7073c3c64eb 100644 --- a/source/smbd/mangle_hash.c +++ b/source/smbd/mangle_hash.c @@ -432,6 +432,13 @@ static void cache_mangled_name( const char mangled_name[13], if( !s1[i] && !s2[i] ) { /* Truncate at the '.' */ *s1 = '\0'; + /* + * DANGER WILL ROBINSON - this + * is changing a const string via + * an aliased pointer ! Remember to + * put it back once we've used it. + * JRA + */ *s2 = '\0'; } } @@ -443,6 +450,8 @@ static void cache_mangled_name( const char mangled_name[13], } else { DEBUG(5,("cache_mangled_name: Stored entry %s -> %s\n", mangled_name_key, raw_name)); } + /* Restore the change we made to the const string. */ + *s2 = '.'; } /* ************************************************************************** ** |