summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/lib/charcnv.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index 3ec3220900..c3b345142f 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -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;
}