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
216ba4f0
Commit
216ba4f0
authored
Jul 20, 2004
by
Zhangrong Huang
Committed by
Alexandre Julliard
Jul 20, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Call wine_cp_wcstombs() to retrieve actual length of buffer before
conversion.
parent
907ac44a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
write.c
tools/wmc/write.c
+10
-6
No files found.
tools/wmc/write.c
View file @
216ba4f0
...
...
@@ -94,12 +94,14 @@ static char str_header[] =
static
char
*
dup_u2c
(
int
cp
,
const
WCHAR
*
uc
)
{
int
len
=
unistrlen
(
uc
)
;
char
*
cptr
=
xmalloc
(
len
+
1
)
;
int
len
;
char
*
cptr
;
const
union
cptable
*
cpdef
=
find_codepage
(
cp
);
if
(
!
cpdef
)
internal_error
(
__FILE__
,
__LINE__
,
"Codepage %d not found (vanished?)"
,
cp
);
if
((
len
=
wine_cp_wcstombs
(
cpdef
,
0
,
uc
,
unistrlen
(
uc
)
+
1
,
cptr
,
len
+
1
,
NULL
,
NULL
))
<
0
)
len
=
wine_cp_wcstombs
(
cpdef
,
0
,
uc
,
unistrlen
(
uc
)
+
1
,
NULL
,
0
,
NULL
,
NULL
);
cptr
=
xmalloc
(
len
);
if
((
len
=
wine_cp_wcstombs
(
cpdef
,
0
,
uc
,
unistrlen
(
uc
)
+
1
,
cptr
,
len
,
NULL
,
NULL
))
<
0
)
internal_error
(
__FILE__
,
__LINE__
,
"Buffer overflow? code %d."
,
len
);
return
cptr
;
}
...
...
@@ -377,12 +379,14 @@ static char *make_string(WCHAR *uc, int len, int codepage)
}
else
{
char
*
tmp
=
xmalloc
(
2
*
len
+
1
)
;
char
*
cc
=
tmp
;
char
*
tmp
,
*
cc
;
int
mlen
;
const
union
cptable
*
cpdef
=
find_codepage
(
codepage
);
assert
(
cpdef
!=
NULL
);
if
((
i
=
wine_cp_wcstombs
(
cpdef
,
0
,
uc
,
unistrlen
(
uc
)
+
1
,
tmp
,
2
*
len
+
1
,
NULL
,
NULL
))
<
0
)
mlen
=
wine_cp_wcstombs
(
cpdef
,
0
,
uc
,
unistrlen
(
uc
)
+
1
,
NULL
,
0
,
NULL
,
NULL
);
cc
=
tmp
=
xmalloc
(
mlen
);
if
((
i
=
wine_cp_wcstombs
(
cpdef
,
0
,
uc
,
unistrlen
(
uc
)
+
1
,
tmp
,
mlen
,
NULL
,
NULL
))
<
0
)
internal_error
(
__FILE__
,
__LINE__
,
"Buffer overflow? code %d."
,
i
);
*
cptr
++
=
' '
;
*
cptr
++
=
'"'
;
...
...
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