Even for srclen == 0 we have to return something
authorVolker Lendecke <vl@samba.org>
Sat, 10 Jan 2009 16:59:43 +0000 (17:59 +0100)
committerVolker Lendecke <vl@samba.org>
Mon, 12 Jan 2009 09:50:14 +0000 (10:50 +0100)
This fixes a regression reported by Corinna Vinschen <corinna@vinschen.de>

Thanks,

Volker

source/lib/charcnv.c

index f4efcb2ce23763f3817c9f5bdbd852656db57e6f..e51c33d7cd679c684435205f1212b294b0c021a4 100644 (file)
@@ -547,6 +547,12 @@ bool convert_string_allocate(TALLOC_CTX *ctx, charset_t from, charset_t to,
                return false;
        }
        if (srclen == 0) {
+               ob = ((ctx != NULL) ? talloc_strdup(ctx, "") : SMB_STRDUP(""));
+               if (ob == NULL) {
+                       errno = ENOMEM;
+                       return false;
+               }
+               *dest = ob;
                *converted_size = 0;
                return true;
        }