summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2008-09-09 17:44:41 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-10-21 14:40:40 +0200
commit16ab396d526546c2a55114cbac0e779aa6420601 (patch)
tree1035298df92c75191e72f14921ad96c79b84a144
parentb295dca7a04ca3cea7c7fc285b3e388b58e5c02d (diff)
downloadsamba-16ab396d526546c2a55114cbac0e779aa6420601.tar.gz
samba-16ab396d526546c2a55114cbac0e779aa6420601.tar.bz2
samba-16ab396d526546c2a55114cbac0e779aa6420601.zip
Fix for the empty string (REG_SZ) problem
I enhanced the "utf8_push" function, who finally accepts now also the char sequence "" with length 1 as valid UTF8 string.
-rw-r--r--source4/lib/charset/iconv.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source4/lib/charset/iconv.c b/source4/lib/charset/iconv.c
index d4f930b462..9b15cfb3cc 100644
--- a/source4/lib/charset/iconv.c
+++ b/source4/lib/charset/iconv.c
@@ -600,6 +600,14 @@ static size_t utf8_push(void *cd, const char **inbuf, size_t *inbytesleft,
uint8_t *c = (uint8_t *)*outbuf;
const uint8_t *uc = (const uint8_t *)*inbuf;
+ /* Special case: Windows (e.g. "regedit") also expects an empty buffer
+ with length 1 as a valid empty UTF8 string */
+ if (in_left == 1 && uc[0] == 0 && out_left >= 1) {
+ c[0] = uc[0];
+ in_left -= 1;
+ out_left -= 1;
+ }
+
while (in_left >= 2 && out_left >= 1) {
unsigned int codepoint;