diff options
author | Andrew Tridgell <tridge@samba.org> | 1998-10-03 12:32:18 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1998-10-03 12:32:18 +0000 |
commit | f05f0a01cefbf19943a53c3307eb992d77238b51 (patch) | |
tree | 87965d36af5a253a7cf2c965ea98039baeaf76a1 /source | |
parent | 752e90b24f37d4697b87c65a53b45799c21ecab7 (diff) | |
download | samba-f05f0a01cefbf19943a53c3307eb992d77238b51.tar.gz samba-f05f0a01cefbf19943a53c3307eb992d77238b51.tar.xz samba-f05f0a01cefbf19943a53c3307eb992d77238b51.zip |
fixed a bug in name_len() (thanks to kooros@kooros.netrack.net)
Diffstat (limited to 'source')
-rw-r--r-- | source/lib/util.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/lib/util.c b/source/lib/util.c index 2738bc894ae..c6073cf9d69 100644 --- a/source/lib/util.c +++ b/source/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 */ /**************************************************************************** |