1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-23 20:59:10 +03:00

fixed a bug in name_len() (thanks to kooros@kooros.netrack.net)

This commit is contained in:
Andrew Tridgell
-
parent 752e90b24f
commit f05f0a01ce

View File

@ -2334,21 +2334,21 @@ int name_extract(char *buf,int ofs,char *name)
/**************************************************************************** /****************************************************************************
return the total storage length of a mangled name return the total storage length of a mangled name
****************************************************************************/ ****************************************************************************/
int name_len( char *s ) int name_len(unsigned char *s)
{ {
int len; int len;
/* If the two high bits of the byte are set, return 2. */ /* If the two high bits of the byte are set, return 2. */
if( 0xC0 == (*(unsigned char *)s & 0xC0) ) if (0xC0 == (*s & 0xC0))
return(2); return(2);
/* Add up the length bytes. */ /* Add up the length bytes. */
for( len = 1; (*s); s += (*s) + 1 ) for (len = 1; (*s); s += (*s) + 1) {
{ len += *s + 1;
len += *s + 1; SMB_ASSERT(len < 80);
} }
return( len ); return(len);
} /* name_len */ } /* name_len */
/**************************************************************************** /****************************************************************************