From 6291a9da8927615fd023d4303218774491f743a9 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 3 Oct 1998 12:32:18 +0000 Subject: fixed a bug in name_len() (thanks to kooros@kooros.netrack.net) (This used to be commit f05f0a01cefbf19943a53c3307eb992d77238b51) --- source3/lib/util.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/util.c b/source3/lib/util.c index 2738bc894a..c6073cf9d6 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -2334,21 +2334,21 @@ int name_extract(char *buf,int ofs,char *name) /**************************************************************************** return the total storage length of a mangled name ****************************************************************************/ -int name_len( char *s ) +int name_len(unsigned char *s) { int len; /* If the two high bits of the byte are set, return 2. */ - if( 0xC0 == (*(unsigned char *)s & 0xC0) ) + if (0xC0 == (*s & 0xC0)) return(2); /* Add up the length bytes. */ - for( len = 1; (*s); s += (*s) + 1 ) - { - len += *s + 1; - } + for (len = 1; (*s); s += (*s) + 1) { + len += *s + 1; + SMB_ASSERT(len < 80); + } - return( len ); + return(len); } /* name_len */ /**************************************************************************** -- cgit