diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-08-21 00:07:51 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:34:14 -0500 |
commit | 997da16d6c7bd85ac9e3042fe874f8a5f79208b3 (patch) | |
tree | 91bbf39d4ddbd3599e59e540c4cc4679f374706a /source4/librpc | |
parent | 7c77a16e408f9c9043ba9520082dbad4559e1957 (diff) | |
download | samba-997da16d6c7bd85ac9e3042fe874f8a5f79208b3.tar.gz samba-997da16d6c7bd85ac9e3042fe874f8a5f79208b3.tar.bz2 samba-997da16d6c7bd85ac9e3042fe874f8a5f79208b3.zip |
r9440: Fix bug introduced by new zero-padding code. Caught by the buildfarm.
(This used to be commit 9be03c057e229e9cf7fe8b1db04adb9d2f1efc64)
Diffstat (limited to 'source4/librpc')
-rw-r--r-- | source4/librpc/ndr/ndr_string.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/source4/librpc/ndr/ndr_string.c b/source4/librpc/ndr/ndr_string.c index f5f128574d..97be5f61bf 100644 --- a/source4/librpc/ndr/ndr_string.c +++ b/source4/librpc/ndr/ndr_string.c @@ -641,22 +641,25 @@ NTSTATUS ndr_pull_charset(struct ndr_pull *ndr, int ndr_flags, const char **var, NTSTATUS ndr_push_charset(struct ndr_push *ndr, int ndr_flags, const char *var, uint32_t length, uint8_t byte_mul, int chset) { - ssize_t ret; - NDR_PUSH_NEED_BYTES(ndr, byte_mul*length); + ssize_t ret, required; + + required = byte_mul * length; + + NDR_PUSH_NEED_BYTES(ndr, required); ret = convert_string(CH_UNIX, chset, var, length, - ndr->data+ndr->offset, byte_mul*length); + ndr->data+ndr->offset, required); if (ret == -1) { return ndr_push_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion"); } /* 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); + if (ret < required) { + memset(ndr->data+ndr->offset+ret, 0, required-ret); } - ndr->offset += length; + ndr->offset += required; return NT_STATUS_OK; } |