From c46763419aac3165f0eafbbc786cc929129c5109 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Tue, 28 Feb 2012 13:58:48 +1100 Subject: [PATCH] ndr: Fix NDR push function for dnsp_string Push the actual length of the string not including null-termination. --- librpc/ndr/ndr_dnsp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/librpc/ndr/ndr_dnsp.c b/librpc/ndr/ndr_dnsp.c index 347fbed3fd9..f341c829223 100644 --- a/librpc/ndr/ndr_dnsp.c +++ b/librpc/ndr/ndr_dnsp.c @@ -160,14 +160,13 @@ _PUBLIC_ enum ndr_err_code ndr_pull_dnsp_string(struct ndr_pull *ndr, int ndr_fl enum ndr_err_code ndr_push_dnsp_string(struct ndr_push *ndr, int ndr_flags, const char *string) { int total_len; - total_len = strlen(string) + 1; + total_len = strlen(string); if (total_len > 255) { return ndr_push_error(ndr, NDR_ERR_BUFSIZE, "dns_name of length %d larger than 255", total_len); } NDR_CHECK(ndr_push_uint8(ndr, ndr_flags, (uint8_t)total_len)); - NDR_CHECK(ndr_push_bytes(ndr, (const uint8_t *)string, total_len - 1)); - NDR_PUSH_ALIGN(ndr, 1); + NDR_CHECK(ndr_push_bytes(ndr, (const uint8_t *)string, total_len)); return NDR_ERR_SUCCESS; }