summaryrefslogtreecommitdiff
path: root/source3/rpc_parse
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r--source3/rpc_parse/parse_misc.c12
-rw-r--r--source3/rpc_parse/parse_reg.c7
2 files changed, 9 insertions, 10 deletions
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c
index e4b7578e67..da6ff2c7f6 100644
--- a/source3/rpc_parse/parse_misc.c
+++ b/source3/rpc_parse/parse_misc.c
@@ -458,19 +458,17 @@ void smb_io_buffer3(char *desc, BUFFER3 *buf3, prs_struct *ps, int depth)
/*******************************************************************
creates a BUFFER2 structure.
********************************************************************/
-void make_buffer2(BUFFER2 *str, uint8 *buf, int len)
+void make_buffer2(BUFFER2 *str, const char *buf, int len)
{
ZERO_STRUCTP(str);
- /* max buffer size (allocated size) */
+ /* set up string lengths. */
str->buf_max_len = len;
str->undoc = 0;
- str->buf_len = buf != NULL ? len : 0;
+ str->buf_len = len;
- if (buf != NULL)
- {
- memcpy(str->buffer, buf, MIN(str->buf_len, sizeof(str->buffer)));
- }
+ /* store the string (wide chars) */
+ ascii_to_unistr(str->buffer, buf, len);
}
/*******************************************************************
diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c
index 5512f78499..ce0b7fff87 100644
--- a/source3/rpc_parse/parse_reg.c
+++ b/source3/rpc_parse/parse_reg.c
@@ -761,16 +761,17 @@ void make_reg_r_info(REG_R_INFO *r_r,
uint32 level, char *os_type,
uint32 status)
{
- char buf[512];
int len;
- len = ascii_to_unibuf(buf, os_type, sizeof(buf)-2) - buf;
+ if (r_r == NULL || os_type == NULL) return;
+
+ len = strlen(os_type) * 2;
r_r->ptr1 = 1;
r_r->level = level;
r_r->ptr_type = 1;
- make_buffer2(&(r_r->uni_type), buf, len);
+ make_buffer2(&(r_r->uni_type), os_type, len);
r_r->ptr2 = 1;
r_r->unknown_0 = len;