From a9cbc4e583b6f5eb8269114ced08d97c875876b3 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Tue, 14 Jan 2020 12:36:04 -0500 Subject: [PATCH] error: Set a cap on error dialog text size Otherwise we can get some crazy sized dialogs with errors from libvirt https://bugzilla.redhat.com/show_bug.cgi?id=1786873 Signed-off-by: Cole Robinson --- virtManager/error.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/virtManager/error.py b/virtManager/error.py index e54ca64a3..5b725f103 100644 --- a/virtManager/error.py +++ b/virtManager/error.py @@ -15,6 +15,11 @@ from .baseclass import vmmGObject def _launch_dialog(dialog, primary_text, secondary_text, title, widget=None, modal=True): + if primary_text and len(primary_text) > 512: + primary_text = primary_text[:512] + "..." + if secondary_text and len(secondary_text) > 512: + secondary_text = secondary_text[:512] + "..." + dialog.set_property("text", primary_text) dialog.format_secondary_text(secondary_text or None) dialog.set_title(title)