Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
908c2bec
Commit
908c2bec
authored
Nov 08, 2019
by
Jacek Caban
Committed by
Alexandre Julliard
Nov 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Don't use fixed size buffer in ctl2_encode_name.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e2eb099a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
write_msft.c
tools/widl/write_msft.c
+13
-8
No files found.
tools/widl/write_msft.c
View file @
908c2bec
...
...
@@ -291,27 +291,27 @@ static int ctl2_encode_name(
const
char
*
name
,
/* [I] The name string to encode. */
char
**
result
)
/* [O] A pointer to a pointer to receive the encoded name. */
{
int
length
;
s
tatic
char
converted_name
[
0x104
]
;
char
*
converted_name
;
s
ize_t
length
,
size
;
int
offset
;
int
value
;
length
=
strlen
(
name
);
size
=
(
length
+
7
)
&
~
3
;
converted_name
=
xmalloc
(
size
+
1
);
memcpy
(
converted_name
+
4
,
name
,
length
);
converted_name
[
length
+
4
]
=
0
;
value
=
lhash_val_of_name_sys
(
typelib
->
typelib_header
.
varflags
&
0x0f
,
typelib
->
typelib_header
.
lcid
,
converted_name
+
4
);
#ifdef WORDS_BIGENDIAN
converted_name
[
3
]
=
length
&
0xff
;
converted_name
[
2
]
=
0x00
;
converted_name
[
2
]
=
length
>>
8
;
converted_name
[
1
]
=
value
;
converted_name
[
0
]
=
value
>>
8
;
#else
converted_name
[
0
]
=
length
&
0xff
;
converted_name
[
1
]
=
0x00
;
converted_name
[
1
]
=
length
>>
8
;
converted_name
[
2
]
=
value
;
converted_name
[
3
]
=
value
>>
8
;
#endif
...
...
@@ -320,7 +320,7 @@ static int ctl2_encode_name(
*
result
=
converted_name
;
return
(
length
+
7
)
&
~
3
;
return
size
;
}
/****************************************************************************
...
...
@@ -548,7 +548,11 @@ static int ctl2_alloc_name(
length
=
ctl2_encode_name
(
typelib
,
name
,
&
encoded_name
);
offset
=
ctl2_find_name
(
typelib
,
encoded_name
);
if
(
offset
!=
-
1
)
return
offset
;
if
(
offset
!=
-
1
)
{
free
(
encoded_name
);
return
offset
;
}
offset
=
ctl2_alloc_segment
(
typelib
,
MSFT_SEG_NAME
,
length
+
8
,
0
);
...
...
@@ -565,6 +569,7 @@ static int ctl2_alloc_name(
typelib
->
typelib_header
.
nametablecount
+=
1
;
typelib
->
typelib_header
.
nametablechars
+=
*
encoded_name
;
free
(
encoded_name
);
return
offset
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment