summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-02-18 11:22:44 -0800
committerKarolin Seeger <kseeger@samba.org>2010-02-22 15:50:35 +0100
commit678672b787cbddf5cf31fd2acf6e11a239d5a57b (patch)
tree99ea2f5b0261fba34503cea6c9757f928f82420d
parentcf789124b2f29f999de1519df0e8698345104bcb (diff)
downloadsamba-678672b787cbddf5cf31fd2acf6e11a239d5a57b.tar.gz
samba-678672b787cbddf5cf31fd2acf6e11a239d5a57b.tar.xz
samba-678672b787cbddf5cf31fd2acf6e11a239d5a57b.zip
Fix bug #7154 - mangling method = hash can crash storing a name not containing a '.'
Fix use of uninitialized variable. This can lead to crashes if mangling = hash processes names with no '.'. Jeremy. (cherry picked from commit df13b1303a751962d8f7d5298b39e4a7500fef15) (cherry picked from commit 7eaeb891c8aee880fb06733f998b2feb95ef9c36)
-rw-r--r--source3/smbd/mangle_hash.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/source3/smbd/mangle_hash.c b/source3/smbd/mangle_hash.c
index 679487d94ed..11ccbee3e63 100644
--- a/source3/smbd/mangle_hash.c
+++ b/source3/smbd/mangle_hash.c
@@ -409,8 +409,8 @@ static void cache_mangled_name( const char mangled_name[13],
{
TDB_DATA data_val;
char mangled_name_key[13];
- char *s1;
- char *s2;
+ char *s1 = NULL;
+ char *s2 = NULL;
/* If the cache isn't initialized, give up. */
if( !tdb_mangled_cache )
@@ -449,7 +449,9 @@ static void cache_mangled_name( const char mangled_name[13],
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 = '.';
+ if (s2) {
+ *s2 = '.';
+ }
}
/* ************************************************************************** **