1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-17 02:05:21 +03:00

Deal will NULL UNISTR in unistr_to_ascii

jerry
This commit is contained in:
Gerald Carter -
parent df51dc32f6
commit cfa4c878a2

View File

@ -252,19 +252,27 @@ void unistr_to_ascii(char *dest, const uint16 *src, int len)
{
char *destend = dest + len;
register uint16 c;
/* deal with NULL src strings */
if (src == NULL)
{
*dest = '\0';
}
else
{
while (dest < destend)
{
c = *(src++);
if (c == 0)
{
break;
}
while (dest < destend)
{
c = *(src++);
if (c == 0)
{
break;
}
*(dest++) = (char)c;
}
*(dest++) = (char)c;
}
*dest = 0;
*dest = 0;
}
}
/*******************************************************************