summaryrefslogtreecommitdiff
path: root/source4/librpc/ndr
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-12-29 01:43:11 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:47:57 -0500
commitb9fa7bc48ec3b402722b64b3dbd97042cb2bfd09 (patch)
tree71e9a4077b2beeaf26861eebc5970489cd6e93a8 /source4/librpc/ndr
parentfc8fef69fda3b7a9627adfc6bc5599eff03383a8 (diff)
downloadsamba-b9fa7bc48ec3b402722b64b3dbd97042cb2bfd09.tar.gz
samba-b9fa7bc48ec3b402722b64b3dbd97042cb2bfd09.tar.bz2
samba-b9fa7bc48ec3b402722b64b3dbd97042cb2bfd09.zip
r12558: Support [flag(NULLTERM)] on [charset()] arrays
(This used to be commit 2e5a6eb219feab3208f63d727340a852bfdb0b3f)
Diffstat (limited to 'source4/librpc/ndr')
-rw-r--r--source4/librpc/ndr/ndr_string.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source4/librpc/ndr/ndr_string.c b/source4/librpc/ndr/ndr_string.c
index 96f48edda9..fcc529cbd1 100644
--- a/source4/librpc/ndr/ndr_string.c
+++ b/source4/librpc/ndr/ndr_string.c
@@ -623,6 +623,8 @@ NTSTATUS ndr_check_string_terminator(struct ndr_pull *ndr, uint32_t count, uint3
for (i = 0; i < element_size; i++) {
if (ndr->data[ndr->offset+i] != 0) {
+ ndr_pull_restore(ndr, &save_offset);
+
return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "String terminator not present or outside string boundaries");
}
}
@@ -639,7 +641,15 @@ NTSTATUS ndr_pull_charset(struct ndr_pull *ndr, int ndr_flags, const char **var,
*var = talloc_strdup(ndr->current_mem_ctx, "");
return NT_STATUS_OK;
}
+
NDR_PULL_NEED_BYTES(ndr, length*byte_mul);
+
+ if (ndr->flags & LIBNDR_FLAG_STR_NULLTERM) {
+ /* Explicitly ignore the return value here. An array that
+ * is not zero-terminated is considered a warning only, not fatal */
+ ndr_check_string_terminator(ndr, length, byte_mul);
+ }
+
ret = convert_string_talloc(ndr->current_mem_ctx,
chset, CH_UNIX,
ndr->data+ndr->offset,