summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/charcnv.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index f6b9e06ec2..b1e3d3bdcf 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -1403,15 +1403,18 @@ size_t pull_ucs2(const void *base_ptr, char *dest, const void *src, size_t dest_
{
size_t ret;
- if (!src_len) {
- return 0;
- }
-
if (dest_len == (size_t)-1) {
/* No longer allow dest_len of -1. */
smb_panic("pull_ucs2 - invalid dest_len of -1");
}
+ if (!src_len) {
+ if (dest && dest_len > 0) {
+ dest[0] = '\0';
+ }
+ return 0;
+ }
+
if (ucs2_align(base_ptr, src, flags)) {
src = (const void *)((const char *)src + 1);
if (src_len != (size_t)-1)