summaryrefslogtreecommitdiff
path: root/source/smbd/mangle_hash2.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/smbd/mangle_hash2.c')
-rw-r--r--source/smbd/mangle_hash2.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/source/smbd/mangle_hash2.c b/source/smbd/mangle_hash2.c
index f68873687bd..c6ad1215b09 100644
--- a/source/smbd/mangle_hash2.c
+++ b/source/smbd/mangle_hash2.c
@@ -119,7 +119,7 @@ static const char *reserved_names[] =
this hash needs to be fast with a low collision rate (what hash doesn't?)
*/
-static u32 mangle_hash(const char *key, unsigned length)
+static u32 mangle_hash(const char *key, unsigned int length)
{
u32 value;
u32 i;
@@ -129,6 +129,7 @@ static u32 mangle_hash(const char *key, unsigned length)
doesn't depend on the case of the long name. Note that this
is the only place where we need to use a multi-byte string
function */
+ length = MIN(length,sizeof(fstring)-1);
strncpy(str, key, length);
str[length] = 0;
strupper_m(str);