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
0f16bf1d
Commit
0f16bf1d
authored
May 02, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
May 04, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11: Always zero terminate XIM composition string buffer.
parent
3723b786
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
17 deletions
+12
-17
xim.c
dlls/winex11.drv/xim.c
+12
-17
No files found.
dlls/winex11.drv/xim.c
View file @
0f16bf1d
...
...
@@ -45,8 +45,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(xim);
BOOL
ximInComposeMode
=
FALSE
;
static
WCHAR
*
ime_comp_buf
;
static
DWORD
ime_comp_len
;
static
DWORD
ime_comp_max
;
static
XIMStyle
input_style
=
0
;
static
XIMStyle
input_style_req
=
XIMPreeditCallbacks
|
XIMStatusCallbacks
;
...
...
@@ -73,29 +71,26 @@ static const char *debugstr_xim_style( XIMStyle style )
static
void
xim_update_comp_string
(
UINT
offset
,
UINT
old_len
,
const
WCHAR
*
text
,
UINT
new_len
)
{
UINT
len
=
ime_comp_buf
?
wcslen
(
ime_comp_buf
)
:
0
;
int
diff
=
new_len
-
old_len
;
WCHAR
*
ptr
;
TRACE
(
"offset %u, old_len %u, text %s
\n
"
,
offset
,
old_len
,
debugstr_wn
(
text
,
new_len
)
);
if
(
diff
+
ime_comp_len
>=
ime_comp_max
)
if
(
!
(
ptr
=
realloc
(
ime_comp_buf
,
(
len
+
max
(
0
,
diff
)
+
1
)
*
sizeof
(
WCHAR
)
))
)
{
if
(
!
(
ptr
=
realloc
(
ime_comp_buf
,
(
ime_comp_max
+
diff
)
*
sizeof
(
WCHAR
)
)))
{
ERR
(
"Couldn't expand composition string buffer
\n
"
);
return
;
}
ime_comp_buf
=
ptr
;
ime_comp_max
+=
diff
;
ERR
(
"Failed to reallocate composition string buffer
\n
"
);
return
;
}
ime_comp_buf
=
ptr
;
ptr
=
ime_comp_buf
+
offset
;
memmove
(
ptr
+
new_len
,
ptr
+
old_len
,
(
ime_comp_
len
-
offset
-
old_len
)
*
sizeof
(
WCHAR
)
);
memmove
(
ptr
+
new_len
,
ptr
+
old_len
,
(
len
-
offset
-
old_len
)
*
sizeof
(
WCHAR
)
);
if
(
text
)
memcpy
(
ptr
,
text
,
new_len
*
sizeof
(
WCHAR
)
);
ime_comp_len
+=
diff
;
len
+=
diff
;
ime_comp_buf
[
len
]
=
0
;
x11drv_client_func
(
client_func_ime_set_composition_string
,
ime_comp_buf
,
ime_comp_
len
*
sizeof
(
WCHAR
)
);
x11drv_client_func
(
client_func_ime_set_composition_string
,
ime_comp_buf
,
len
*
sizeof
(
WCHAR
)
);
}
void
X11DRV_XIMLookupChars
(
const
char
*
str
,
UINT
count
)
...
...
@@ -105,8 +100,9 @@ void X11DRV_XIMLookupChars( const char *str, UINT count )
TRACE
(
"%p %u
\n
"
,
str
,
count
);
if
(
!
(
output
=
malloc
(
count
*
sizeof
(
WCHAR
)
)))
return
;
if
(
!
(
output
=
malloc
(
(
count
+
1
)
*
sizeof
(
WCHAR
)
)))
return
;
len
=
ntdll_umbstowcs
(
str
,
count
,
output
,
count
);
output
[
len
]
=
0
;
x11drv_client_func
(
client_func_ime_set_result
,
output
,
len
*
sizeof
(
WCHAR
)
);
free
(
output
);
...
...
@@ -155,8 +151,7 @@ static int xic_preedit_done( XIC xic, XPointer user, XPointer arg )
ximInComposeMode
=
FALSE
;
free
(
ime_comp_buf
);
ime_comp_buf
=
NULL
;
ime_comp_max
=
0
;
ime_comp_len
=
0
;
x11drv_client_call
(
client_ime_set_composition_status
,
FALSE
);
return
0
;
}
...
...
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