We need to be careful about feeding FLTK @:s when they will be used in a
label as that is a formatting character.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4440 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/vncviewer/UserDialog.cxx b/vncviewer/UserDialog.cxx
index e94ab71..0ac5009 100644
--- a/vncviewer/UserDialog.cxx
+++ b/vncviewer/UserDialog.cxx
@@ -34,6 +34,7 @@
#include <rfb/Exception.h>
#include "i18n.h"
+#include "fltk_layout.h"
#include "parameters.h"
#include "UserDialog.h"
@@ -137,6 +138,11 @@
bool UserDialog::showMsgBox(int flags, const char* title, const char* text)
{
+ char buffer[1024];
+
+ if (fltk_escape(text, buffer, sizeof(buffer)) >= sizeof(buffer))
+ return 0;
+
// FLTK doesn't give us a flexible choice of the icon, so we ignore those
// bits for now.
@@ -146,16 +152,16 @@
switch (flags & 0xf) {
case M_OKCANCEL:
- return fl_choice(text, NULL, fl_ok, fl_cancel) == 1;
+ return fl_choice(buffer, NULL, fl_ok, fl_cancel) == 1;
case M_YESNO:
- return fl_choice(text, NULL, fl_yes, fl_no) == 1;
+ return fl_choice(buffer, NULL, fl_yes, fl_no) == 1;
case M_OK:
default:
if (((flags & 0xf0) == M_ICONERROR) ||
((flags & 0xf0) == M_ICONWARNING))
- fl_alert(text);
+ fl_alert(buffer);
else
- fl_message(text);
+ fl_message(buffer);
return true;
}