mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
r3073: Fix bug in the handling of null-terminated ASCII strings in RPC.
Because we didn't count the null terminator, we would not move past it
in the packet.
Andrew Bartlett
(This used to be commit 8b38bffc70
)
This commit is contained in:
parent
72093ce62f
commit
31e96d8def
@ -1119,6 +1119,24 @@ int strcmp_safe(const char *s1, const char *s2)
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
return the number of bytes occupied by a buffer in ASCII format
|
||||
the result includes the null termination
|
||||
limited by 'n' bytes
|
||||
********************************************************************/
|
||||
size_t ascii_len_n(const char *src, size_t n)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
len = strnlen(src, n);
|
||||
if (len+1 <= n) {
|
||||
len += 1;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
Return a string representing a CIFS attribute for a file.
|
||||
********************************************************************/
|
||||
|
@ -657,7 +657,7 @@ NTSTATUS ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, const char **s)
|
||||
|
||||
case LIBNDR_FLAG_STR_NULLTERM:
|
||||
if (byte_mul == 1) {
|
||||
len1 = strnlen(ndr->data+ndr->offset, ndr->data_size - ndr->offset);
|
||||
len1 = ascii_len_n(ndr->data+ndr->offset, ndr->data_size - ndr->offset);
|
||||
} else {
|
||||
len1 = utf16_len_n(ndr->data+ndr->offset, ndr->data_size - ndr->offset);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user