summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-09-21 10:32:57 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:30:57 -0500
commit3f2939cc167cca2e7f5758f231b470507c600360 (patch)
tree0da497a8b3ea7cf7c24162b7356978b47e8ae0c5 /source3/lib
parentba93d0e5c8418eb11a5fa0bb48c1ec3a0ebd403b (diff)
downloadsamba-3f2939cc167cca2e7f5758f231b470507c600360.tar.gz
samba-3f2939cc167cca2e7f5758f231b470507c600360.tar.bz2
samba-3f2939cc167cca2e7f5758f231b470507c600360.zip
r25277: Belt-and-braces approach to Volker's fix for RPC-SAMBA3-GETUSERNAME.
If we promise dest is null terminated, ensure we do it even on fast path exits. Jeremy. (This used to be commit 32626e2b9770eb6b15c191a8feb881f81ed6c57a)
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)