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-24 16:25:10 +0100
commit5657bfc7c85827969933c57d5193b214215c279c (patch)
treecd7fc4fdbe680758fc16fe4c05a118deba2c8631
parenta7dc17eedc69a838fb00d0535bf2e459d2841f8a (diff)
downloadsamba-5657bfc7c85827969933c57d5193b214215c279c.tar.gz
samba-5657bfc7c85827969933c57d5193b214215c279c.tar.xz
samba-5657bfc7c85827969933c57d5193b214215c279c.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 e904ccd25a3b7050a8d1895c9535e42abd0b4d07)
-rw-r--r--source/smbd/mangle_hash.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/source/smbd/mangle_hash.c b/source/smbd/mangle_hash.c
index e081a57484a..31e734de9dd 100644
--- a/source/smbd/mangle_hash.c
+++ b/source/smbd/mangle_hash.c
@@ -412,8 +412,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 )
@@ -452,7 +452,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 = '.';
+ }
}
/* ************************************************************************** **