From 7c77a16e408f9c9043ba9520082dbad4559e1957 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 20 Aug 2005 23:36:43 +0000 Subject: r9439: Make sure the remainder of the array is always initialized if the buffer is larger then the string to be pushed. (This used to be commit 70b52e26f31b00637ed7f90f77ff0b2794dad729) --- source4/librpc/ndr/ndr_string.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'source4/librpc/ndr/ndr_string.c') 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; } -- cgit