mirror of
https://github.com/samba-team/samba.git
synced 2025-02-23 09:57:40 +03:00
Added Andrew Bartlett's patch to use an allocated buffer for count_chars.
Jeremy.
This commit is contained in:
parent
a7d4a6d116
commit
4ec9e33078
@ -557,10 +557,16 @@ size_t count_chars(const char *s,char c)
|
|||||||
{
|
{
|
||||||
smb_ucs2_t *ptr;
|
smb_ucs2_t *ptr;
|
||||||
int count;
|
int count;
|
||||||
push_ucs2(NULL, tmpbuf,s, sizeof(tmpbuf), STR_TERMINATE);
|
smb_ucs2_t *alloc_tmpbuf;
|
||||||
for(count=0,ptr=tmpbuf;*ptr;ptr++)
|
|
||||||
|
if (push_ucs2_allocate(&alloc_tmpbuf, s) == (size_t)-1) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(count=0,ptr=alloc_tmpbuf;*ptr;ptr++)
|
||||||
if(*ptr==UCS2_CHAR(c))
|
if(*ptr==UCS2_CHAR(c))
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
return(count);
|
return(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user