summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-10-03 12:32:18 +0000
committerAndrew Tridgell <tridge@samba.org>1998-10-03 12:32:18 +0000
commit6291a9da8927615fd023d4303218774491f743a9 (patch)
treec14141afdaf01d0bbd125d444760d94b7f572deb
parent4b760a63da12f65d505f1c0ba4e909f6fb1d27c0 (diff)
downloadsamba-6291a9da8927615fd023d4303218774491f743a9.tar.gz
samba-6291a9da8927615fd023d4303218774491f743a9.tar.bz2
samba-6291a9da8927615fd023d4303218774491f743a9.zip
fixed a bug in name_len() (thanks to kooros@kooros.netrack.net)
(This used to be commit f05f0a01cefbf19943a53c3307eb992d77238b51)
-rw-r--r--source3/lib/util.c14
1 files changed, 7 insertions, 7 deletions
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 */
/****************************************************************************