[gtk/gtk-3-24: 1/2] imwayland: Honour len argument in gtk_im_context_wayland_set_surrounding
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-24: 1/2] imwayland: Honour len argument in gtk_im_context_wayland_set_surrounding
- Date: Mon, 16 Mar 2020 16:11:03 +0000 (UTC)
commit 3c28751dee115e969a58a733f2f19e71062b9d2d
Author: Robert Mader <robert mader posteo de>
Date: Mon Mar 16 16:26:48 2020 +0100
imwayland: Honour len argument in gtk_im_context_wayland_set_surrounding
Clients may pass not `NULL`-terminated strings as the function takes a
`len` argument. Use that argument.
modules/input/imwayland.c | 2 +-
modules/input/imwaylandgtk.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/modules/input/imwayland.c b/modules/input/imwayland.c
index 199714d046..821f2f678c 100644
--- a/modules/input/imwayland.c
+++ b/modules/input/imwayland.c
@@ -828,7 +828,7 @@ gtk_im_context_wayland_set_surrounding (GtkIMContext *context,
context_wayland = GTK_IM_CONTEXT_WAYLAND (context);
g_free (context_wayland->surrounding.text);
- context_wayland->surrounding.text = g_strdup (text);
+ context_wayland->surrounding.text = g_strndup (text, len);
context_wayland->surrounding.cursor_idx = cursor_index;
/* Anchor is not exposed via the set_surrounding interface, emulating. */
context_wayland->surrounding.anchor_idx = cursor_index;
diff --git a/modules/input/imwaylandgtk.c b/modules/input/imwaylandgtk.c
index 58a5e48c29..207891d502 100644
--- a/modules/input/imwaylandgtk.c
+++ b/modules/input/imwaylandgtk.c
@@ -598,7 +598,7 @@ gtk_im_context_wayland_set_surrounding (GtkIMContext *context,
context_wayland = GTK_IM_CONTEXT_WAYLAND (context);
g_free (context_wayland->surrounding.text);
- context_wayland->surrounding.text = g_strdup (text);
+ context_wayland->surrounding.text = g_strndup (text, len);
context_wayland->surrounding.cursor_idx = cursor_index;
notify_surrounding_text (context_wayland);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]