summaryrefslogtreecommitdiff
path: root/source3/rpc_parse/parse_misc.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-08-11 23:13:09 +0000
committerJeremy Allison <jra@samba.org>2000-08-11 23:13:09 +0000
commitf6795780eb2384d17b31650419348b1c89bb5fbe (patch)
tree7ff2f704c91ea68776e222f28ec94e0eebbead7b /source3/rpc_parse/parse_misc.c
parent726e7e256e9c6d9767dea6cc600b75522ee84f07 (diff)
downloadsamba-f6795780eb2384d17b31650419348b1c89bb5fbe.tar.gz
samba-f6795780eb2384d17b31650419348b1c89bb5fbe.tar.bz2
samba-f6795780eb2384d17b31650419348b1c89bb5fbe.zip
Fixed the problem with UNISTR marshalling in a buffer5 struct.
The smb_io_unistr() code called a prs_align, this was not being counted in the size or taken account of in the offset calculation. Fixed size_ calculation to always return a size a multiple of 4 and also set the offset correctly. This fixes the problem I saw and will hopefully fix the problem HP reported. JF please check this change. Jeremy. (This used to be commit ceba9f3dcdb4bddae17ec0024692c9074086302d)
Diffstat (limited to 'source3/rpc_parse/parse_misc.c')
-rw-r--r--source3/rpc_parse/parse_misc.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c
index 02ab707a40..e7b8c23619 100644
--- a/source3/rpc_parse/parse_misc.c
+++ b/source3/rpc_parse/parse_misc.c
@@ -475,8 +475,7 @@ void init_unistr(UNISTR *str, const char *buf)
{
size_t len;
- if (buf == NULL)
- {
+ if (buf == NULL) {
str->buffer = NULL;
return;
}
@@ -484,21 +483,19 @@ void init_unistr(UNISTR *str, const char *buf)
len = strlen(buf) + 1;
- if (!parse_misc_talloc)
+ if (!parse_misc_talloc)
parse_misc_talloc = talloc_init();
if (len < MAX_UNISTRLEN)
len = MAX_UNISTRLEN;
len *= sizeof(uint16);
- str->buffer = (uint16 *)talloc(parse_misc_talloc, len);
+ str->buffer = (uint16 *)talloc(parse_misc_talloc, len);
if (str->buffer == NULL)
- smb_panic("init_unistr2: malloc fail\n");
+ smb_panic("init_unistr: malloc fail\n");
/* store the string (null-terminated copy) */
dos_struni2((char *)str->buffer, buf, len);
-
- return;
}
/*******************************************************************