[gnome-builder/gnome-builder-41] ide: terminate plain diagnostic string



commit f9096618c743962eae923d34efd448112591a1f6
Author: Günther Wagner <info gunibert de>
Date:   Sun Dec 5 16:07:36 2021 +0100

    ide: terminate plain diagnostic string
    
    GtkLabel expects a proper null terminated UTF-8 string.

 src/libide/gui/ide-marked-view.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/src/libide/gui/ide-marked-view.c b/src/libide/gui/ide-marked-view.c
index 4bac9b2fa..2dbdfc6bc 100644
--- a/src/libide/gui/ide-marked-view.c
+++ b/src/libide/gui/ide-marked-view.c
@@ -369,17 +369,19 @@ ide_marked_view_new (IdeMarkedContent *content)
     default:
     case IDE_MARKED_KIND_PLAINTEXT:
     case IDE_MARKED_KIND_PANGO:
-      child = g_object_new (GTK_TYPE_LABEL,
-                            "max-width-chars", 80,
-                            "selectable", TRUE,
-                            "wrap", TRUE,
-                            "xalign", 0.0f,
-                            "visible", TRUE,
-                            "use-markup", kind == IDE_MARKED_KIND_PANGO,
-                            "label", markup,
-                            NULL);
-      break;
-
+      {
+        g_autofree char *markup_nul_terminated = g_strndup (markup, markup_len);
+        child = g_object_new (GTK_TYPE_LABEL,
+                              "max-width-chars", 80,
+                              "selectable", TRUE,
+                              "wrap", TRUE,
+                              "xalign", 0.0f,
+                              "visible", TRUE,
+                              "use-markup", kind == IDE_MARKED_KIND_PANGO,
+                              "label", markup_nul_terminated,
+                              NULL);
+        break;
+      }
     case IDE_MARKED_KIND_HTML:
 #ifdef HAVE_WEBKIT
       child = g_object_new (WEBKIT_TYPE_WEB_VIEW,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]