[SCM] Samba Shared Repository - branch v3-5-test updated

Jeremy Allison jra at samba.org
Mon Dec 21 18:48:43 MST 2009


The branch, v3-5-test has been updated
       via  4f44270... Fix bug reported in mangle_hash code (no bugid yet).
      from  6a2c2a7... s3:winbind: Add a lower-cost alternative to wbinfo -t: wbinfo --ping-dc

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-5-test


- Log -----------------------------------------------------------------
commit 4f442702065e1e5fd5bd3766fbd9bd4d11210511
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Dec 21 17:46:32 2009 -0800

    Fix bug reported in mangle_hash code (no bugid yet).
    
    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 100168dfec533a7afd8f2dd246f1b66b11ad7162)

-----------------------------------------------------------------------

Summary of changes:
 source3/smbd/mangle_hash.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/mangle_hash.c b/source3/smbd/mangle_hash.c
index c08bc40..8369af4 100644
--- a/source3/smbd/mangle_hash.c
+++ b/source3/smbd/mangle_hash.c
@@ -429,6 +429,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';
 		}
 	}
@@ -440,6 +447,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 = '.';
 }
 
 /* ************************************************************************** **


-- 
Samba Shared Repository


More information about the samba-cvs mailing list