summaryrefslogtreecommitdiffstats
path: root/source/rpc_parse/parse_misc.c
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2000-07-28 06:27:32 +0000
committerTim Potter <tpot@samba.org>2000-07-28 06:27:32 +0000
commit4ab75143c4466ad0ea8443512dd5ade449d72462 (patch)
tree21fcdea53830e16f9105581ed95bdc766c8e8655 /source/rpc_parse/parse_misc.c
parent9178d2a1aac26f8d6533f7dc86ff9b19eb72db8b (diff)
downloadsamba-4ab75143c4466ad0ea8443512dd5ade449d72462.tar.gz
samba-4ab75143c4466ad0ea8443512dd5ade449d72462.tar.xz
samba-4ab75143c4466ad0ea8443512dd5ade449d72462.zip
Fixed read overrun in init_string2()
Diffstat (limited to 'source/rpc_parse/parse_misc.c')
-rw-r--r--source/rpc_parse/parse_misc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/rpc_parse/parse_misc.c b/source/rpc_parse/parse_misc.c
index 2a642e1cec1..276e66a113d 100644
--- a/source/rpc_parse/parse_misc.c
+++ b/source/rpc_parse/parse_misc.c
@@ -775,6 +775,8 @@ void copy_unistr2(UNISTR2 *str, UNISTR2 *from)
void init_string2(STRING2 *str, char *buf, int len)
{
+ int alloc_len = 0;
+
/* set up string lengths. */
str->str_max_len = len;
str->undoc = 0;
@@ -786,8 +788,8 @@ void init_string2(STRING2 *str, char *buf, int len)
parse_misc_talloc = talloc_init();
if (len < MAX_STRINGLEN)
- len = MAX_STRINGLEN;
- str->buffer = talloc(parse_misc_talloc, len);
+ alloc_len = MAX_STRINGLEN;
+ str->buffer = talloc(parse_misc_talloc, alloc_len);
if (str->buffer == NULL)
smb_panic("init_string2: malloc fail\n");
memcpy(str->buffer, buf, len);