summaryrefslogtreecommitdiff
path: root/source3/lib/charcnv.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-04-23 14:07:33 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-04-23 14:07:33 +0000
commit66468d23158694383f3759464ffa7ade1c1d6d6c (patch)
treebac4cf18f706365582693752c3cad8f1d14f7da9 /source3/lib/charcnv.c
parent11c453951a336969df3523779046fbd1380bcd64 (diff)
downloadsamba-66468d23158694383f3759464ffa7ade1c1d6d6c.tar.gz
samba-66468d23158694383f3759464ffa7ade1c1d6d6c.tar.bz2
samba-66468d23158694383f3759464ffa7ade1c1d6d6c.zip
Patch by Metze to ensure that we always at least initialize our output string
for rpc_pull_string. If we had a NULL or zero-length string, we would use uninitialised data in the result string. Andrew Bartlett (This used to be commit df10aee451b431a8a056a949a98393da256185da)
Diffstat (limited to 'source3/lib/charcnv.c')
-rw-r--r--source3/lib/charcnv.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index 7acb7147fd..5086f924db 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -420,6 +420,8 @@ size_t pull_ascii(char *dest, const void *src, size_t dest_len, size_t src_len,
if (dest_len)
dest[MIN(ret, dest_len-1)] = 0;
+ else
+ dest[0] = 0;
return src_len;
}
@@ -629,6 +631,8 @@ size_t pull_ucs2(const void *base_ptr, char *dest, const void *src, size_t dest_
ret = convert_string(CH_UCS2, CH_UNIX, src, src_len, dest, dest_len);
if (dest_len)
dest[MIN(ret, dest_len-1)] = 0;
+ else
+ dest[0] = 0;
return src_len;
}