From ccc65fb995154451537879b57b900b8b4e340bd2 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 17 Jul 2005 09:13:05 +0000 Subject: r8519: better method of ensuring null termination (This used to be commit f93bd0ced6b0b2b4ee3bf15e53ba30138fd6b533) --- source4/librpc/ndr/ndr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c index 3f2b797fee..3a291c2cf8 100644 --- a/source4/librpc/ndr/ndr.c +++ b/source4/librpc/ndr/ndr.c @@ -156,6 +156,9 @@ DATA_BLOB ndr_push_blob(struct ndr_push *ndr) DATA_BLOB blob; blob.data = ndr->data; blob.length = ndr->offset; + if (ndr->alloc_size > ndr->offset) { + ndr->data[ndr->offset] = 0; + } return blob; } @@ -166,7 +169,6 @@ DATA_BLOB ndr_push_blob(struct ndr_push *ndr) NTSTATUS ndr_push_expand(struct ndr_push *ndr, uint32_t size) { if (ndr->alloc_size > size) { - ndr->data[size] = 0; return NT_STATUS_OK; } -- cgit