On Wednesday, September 07, 2011 09:56:59 AM Alejandro Escanero Blanco wrote: > In samba3.6 I get a reject: rebased on release-3-6-0rc1-1-g69ee029
Gregor
From 69ee029c470c9942e3c1dccbab1df8c9a9684cbb Mon Sep 17 00:00:00 2001 From: Gregor Beck <[email protected]> Date: Tue, 6 Sep 2011 09:24:10 +0200 Subject: [PATCH] s3:registry: reg_format: handle unterminated REG_SZ blobs --- source3/registry/reg_format.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/source3/registry/reg_format.c b/source3/registry/reg_format.c index f2b0846..c9f8233 100644 --- a/source3/registry/reg_format.c +++ b/source3/registry/reg_format.c @@ -325,6 +325,12 @@ done: return ret; } +static bool is_zero_terminated_ucs2(const uint8_t* data, size_t len) { + const size_t idx = len/sizeof(smb_ucs2_t); + const smb_ucs2_t *str = (const smb_ucs2_t*)data; + return (idx > 0) && (str[idx] == 0); +} + int reg_format_value(struct reg_format* f, const char* name, uint32_t type, const uint8_t* data, size_t len) { @@ -333,7 +339,9 @@ int reg_format_value(struct reg_format* f, const char* name, uint32_t type, switch (type) { case REG_SZ: - if (!(f->flags & REG_FMT_HEX_SZ)) { + if (!(f->flags & REG_FMT_HEX_SZ) + && is_zero_terminated_ucs2(data, len)) + { char* str = NULL; size_t dlen; if (pull_ucs2_talloc(mem_ctx, &str, (const smb_ucs2_t*)data, &dlen)) { -- 1.7.6
-- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/options/samba
