diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-11-22 11:49:22 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-11-22 11:49:22 +0000 |
commit | be77d9c60d17e0ef2ed0b51ea0814c42a41a40a3 (patch) | |
tree | f7c66a83daa4a555a7029a54b2fc7886ad1f0d91 /source4/librpc/ndr/ndr_basic.c | |
parent | 677fb26deba2e8b8965c41d7b7455063db031a2c (diff) | |
download | samba-be77d9c60d17e0ef2ed0b51ea0814c42a41a40a3.tar.gz samba-be77d9c60d17e0ef2ed0b51ea0814c42a41a40a3.tar.bz2 samba-be77d9c60d17e0ef2ed0b51ea0814c42a41a40a3.zip |
* fixed null terminated string handling
* fixed nested relative offsets in push functions
the spoolss torture test now passes!
(This used to be commit 60ced76160e4f4e2b511ebbeec31130c8ebcdd22)
Diffstat (limited to 'source4/librpc/ndr/ndr_basic.c')
-rw-r--r-- | source4/librpc/ndr/ndr_basic.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c index a3c4bc0aec..4d0be44a89 100644 --- a/source4/librpc/ndr/ndr_basic.c +++ b/source4/librpc/ndr/ndr_basic.c @@ -397,15 +397,20 @@ NTSTATUS ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, const char **s) break; case LIBNDR_FLAG_STR_NULLTERM: + len1 = strnlen_w(ndr->data+ndr->offset, + (ndr->data_size - ndr->offset)/2); + if (len1*2+2 <= ndr->data_size - ndr->offset) { + len1++; + } ret = convert_string_talloc(ndr->mem_ctx, CH_UCS2, CH_UNIX, ndr->data+ndr->offset, - ndr->data_size - ndr->offset, + len1*2, (const void **)s); if (ret == -1) { return ndr_pull_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion"); } - NDR_CHECK(ndr_pull_advance(ndr, ret)); + NDR_CHECK(ndr_pull_advance(ndr, len1*2)); break; case LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_SIZE4: |