From d452cd061cbc8a1a4fcf78139fd5386800f4f48d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 13 Aug 2005 03:17:18 +0000 Subject: r9300: cope with zero length in ndr_pull_charset() (This used to be commit 1ae255aba44f4444486ae5bc634c8ab1a6328c87) --- source4/librpc/ndr/ndr_string.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source4/librpc') diff --git a/source4/librpc/ndr/ndr_string.c b/source4/librpc/ndr/ndr_string.c index 11397aaafd..50fa887a34 100644 --- a/source4/librpc/ndr/ndr_string.c +++ b/source4/librpc/ndr/ndr_string.c @@ -621,6 +621,10 @@ NTSTATUS ndr_check_string_terminator(struct ndr_pull *ndr, const void *_var, uin NTSTATUS ndr_pull_charset(struct ndr_pull *ndr, int ndr_flags, const char **var, uint32_t length, uint8_t byte_mul, int chset) { int ret; + if (length == 0) { + *var = talloc_strdup(ndr, ""); + return NT_STATUS_OK; + } NDR_PULL_NEED_BYTES(ndr, length*byte_mul); ret = convert_string_talloc(ndr, chset, CH_UNIX, ndr->data+ndr->offset, -- cgit