summaryrefslogtreecommitdiff
path: root/src/ui.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-06-29 14:17:02 +0200
committerBram Moolenaar <Bram@vim.org>2013-06-29 14:17:02 +0200
commitfe17e7640d242e717e9498158570fe3eea2a769b (patch)
treefb6ce1298e71a1d21b022246e4fb3525f7ab8181 /src/ui.c
parent72179e1bd0bbb1d1c3083c85bd9fb0a8d6928f7f (diff)
downloadvim-git-fe17e7640d242e717e9498158570fe3eea2a769b.tar.gz
updated for version 7.3.1262v7.3.1262
Problem: Crash and compilation warnings with Cygwin. Solution: Check return value of XmbTextListToTextProperty(). Add type casts. Adjust #ifdefs. (Lech Lorens)
Diffstat (limited to 'src/ui.c')
-rw-r--r--src/ui.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ui.c b/src/ui.c
index 49bc56b93..714d1938b 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -2366,14 +2366,20 @@ clip_x11_convert_selection_cb(w, sel_atom, target, type, value, length, format)
{
XTextProperty text_prop;
char *string_nt = (char *)alloc((unsigned)*length + 1);
+ int conv_result;
/* create NUL terminated string which XmbTextListToTextProperty wants */
mch_memmove(string_nt, string, (size_t)*length);
string_nt[*length] = NUL;
- XmbTextListToTextProperty(X_DISPLAY, (char **)&string_nt, 1,
- XCompoundTextStyle, &text_prop);
+ conv_result = XmbTextListToTextProperty(X_DISPLAY, (char **)&string_nt,
+ 1, XCompoundTextStyle, &text_prop);
vim_free(string_nt);
XtFree(*value); /* replace with COMPOUND text */
+ if (conv_result != Success)
+ {
+ vim_free(string);
+ return False;
+ }
*value = (XtPointer)(text_prop.value); /* from plain text */
*length = text_prop.nitems;
*type = compound_text_atom;