Skip to content

screen: Fix string leak in terminal_screen_paste_unsafe_text

Leak report

Direct leak of 22 byte(s) in 1 object(s) allocated from:
    #0 0x628c13da4409 in malloc (/usr/asan/bin/xfce4-terminal+0x1f2409)
    #1 0x770bac26a04a in g_malloc /usr/src/debug/glib2/build/../glib/glib/gmem.c:100:13
    #2 0x770bac28031a in g_strdup /usr/src/debug/glib2/build/../glib/glib/gstrfuncs.c:323:17
    #3 0x770bac38f4ec in g_strdup_inline /usr/src/debug/glib2/build/../glib/glib/gstrfuncs.h:321:10
    #4 0x770bac38f4ec in value_lcopy_string /usr/src/debug/glib2/build/../glib/gobject/gvaluetypes.c:315:17
    #5 0x770bad3533f6 in gtk_tree_model_get_valist gtk/gtktreemodel.c:1812:7
    #6 0x770bad352a3e in gtk_tree_model_get gtk/gtktreemodel.c:1774:3
    #7 0x770bacedf395 in gtk_combo_box_text_get_active_text gtk/gtkcomboboxtext.c:623:7
    #8 0x628c13e22a85 in terminal_screen_paste_unsafe_text xfce4-terminal/terminal/terminal-screen.c:1942:20
    #9 0x628c13e22100 in terminal_screen_paste_clipboard xfce4-terminal/terminal/terminal-screen.c:2530:5
    #10 0x628c13e53090 in terminal_window_action_paste xfce4-terminal/terminal/terminal-window.c:1733:5
[...snip...]

Steps to reproduce

  • Enable "Show unsafe paste dialog" in Edit > Preferences
  • Paste two lines of text into the terminal
  • Click the Paste button in the unsafe paste dialog

Testing

  • No issues were detected with LSan, ASan, or Valgrind when testing the patch

Merge request reports