summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/librpc/ndr/ndr_string.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source4/librpc/ndr/ndr_string.c b/source4/librpc/ndr/ndr_string.c
index 50fa887a34..f5f128574d 100644
--- a/source4/librpc/ndr/ndr_string.c
+++ b/source4/librpc/ndr/ndr_string.c
@@ -650,7 +650,13 @@ NTSTATUS ndr_push_charset(struct ndr_push *ndr, int ndr_flags, const char *var,
return ndr_push_error(ndr, NDR_ERR_CHARCNV,
"Bad character conversion");
}
- ndr->offset += ret;
+
+ /* Make sure the remaining part of the string is filled with zeroes */
+ if (ret < (byte_mul*length)) {
+ memset(ndr->data+ndr->offset+ret, 0, (byte_mul*length)-ret);
+ }
+
+ ndr->offset += length;
return NT_STATUS_OK;
}