summaryrefslogtreecommitdiff
path: root/source3/smbd/mangle_hash.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-02-18 11:22:44 -0800
committerJeremy Allison <jra@samba.org>2010-02-18 11:22:44 -0800
commitdf13b1303a751962d8f7d5298b39e4a7500fef15 (patch)
treecae23cd403f2196494774b042bcf388f5098f067 /source3/smbd/mangle_hash.c
parent0bf9c5ecf60d0264b4a7ba3070b3511adb7bd28c (diff)
downloadsamba-df13b1303a751962d8f7d5298b39e4a7500fef15.tar.gz
samba-df13b1303a751962d8f7d5298b39e4a7500fef15.tar.bz2
samba-df13b1303a751962d8f7d5298b39e4a7500fef15.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.
Diffstat (limited to 'source3/smbd/mangle_hash.c')
-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 8369af418a..1482d10b7a 100644
--- a/source3/smbd/mangle_hash.c
+++ b/source3/smbd/mangle_hash.c
@@ -408,8 +408,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 )
@@ -448,7 +448,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 = '.';
+ }
}
/* ************************************************************************** **