summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJean-François Micouleau <jfm@samba.org>2000-10-05 12:41:31 +0000
committerJean-François Micouleau <jfm@samba.org>2000-10-05 12:41:31 +0000
commita4cd5013f58f5d58ee9ef7fe4366b377904d85e3 (patch)
tree6108290d7a62ca1c69061696fb00bf9b6cddb8c3 /source3
parentf0873c24656e0b1019b25e66e5fd0c0a38ea789f (diff)
downloadsamba-a4cd5013f58f5d58ee9ef7fe4366b377904d85e3.tar.gz
samba-a4cd5013f58f5d58ee9ef7fe4366b377904d85e3.tar.bz2
samba-a4cd5013f58f5d58ee9ef7fe4366b377904d85e3.zip
fixing prs_unistr2(). For the special case of an empty (but existing)
string. J.F. (This used to be commit 83bfe94771e0afbffbb4a1a741cd9983ef612362)
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_parse/parse_prs.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c
index d6e5797aaf..401efaadc6 100644
--- a/source3/rpc_parse/parse_prs.c
+++ b/source3/rpc_parse/parse_prs.c
@@ -617,22 +617,24 @@ BOOL prs_unistr2(BOOL charmode, char *name, prs_struct *ps, int depth, UNISTR2 *
return False;
if (UNMARSHALLING(ps)) {
- str->buffer = (uint16 *)prs_alloc_mem(ps,str->uni_str_len * sizeof(uint16));
+ str->buffer = (uint16 *)prs_alloc_mem(ps,str->uni_max_len * sizeof(uint16));
if (str->buffer == NULL)
return False;
+ memset(str->buffer, '\0', str->uni_max_len * sizeof(uint16));
}
+ /* If the string is empty, we don't have anything to stream */
+ if (str->uni_str_len==0)
+ return True;
+
p = (char *)str->buffer;
/* If we're using big-endian, reverse to get little-endian. */
- if(ps->bigendian_data)
- {
+ if(ps->bigendian_data) {
DBG_RW_PSVAL(charmode, name, depth, ps->data_offset,
ps->io, ps->bigendian_data, q, p,
str->uni_str_len)
- }
- else
- {
+ } else {
DBG_RW_PCVAL(charmode, name, depth, ps->data_offset,
ps->io, q, p, str->uni_str_len * sizeof(uint16))
}