summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-17 09:13:05 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:29:34 -0500
commitccc65fb995154451537879b57b900b8b4e340bd2 (patch)
tree6988a21c0e1aaf2c7ce907d36b51eeae20839bc1 /source4
parent92760db79c27e4ffb68401c9893f3276b2f8259e (diff)
downloadsamba-ccc65fb995154451537879b57b900b8b4e340bd2.tar.gz
samba-ccc65fb995154451537879b57b900b8b4e340bd2.tar.bz2
samba-ccc65fb995154451537879b57b900b8b4e340bd2.zip
r8519: better method of ensuring null termination
(This used to be commit f93bd0ced6b0b2b4ee3bf15e53ba30138fd6b533)
Diffstat (limited to 'source4')
-rw-r--r--source4/librpc/ndr/ndr.c4
1 files changed, 3 insertions, 1 deletions
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;
}