Make sure we're paranoid about accidentally feeding a format string.
Basic patch by Joachim Falk. Slightly improved before commit.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4900 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/vncviewer/UserDialog.cxx b/vncviewer/UserDialog.cxx
index f36d843..b57588d 100644
--- a/vncviewer/UserDialog.cxx
+++ b/vncviewer/UserDialog.cxx
@@ -150,22 +150,20 @@
// FLTK doesn't give us a flexible choice of the icon, so we ignore those
// bits for now.
- // FIXME: Filter out % from input text
-
fl_message_title(title);
switch (flags & 0xf) {
case M_OKCANCEL:
- return fl_choice(buffer, NULL, fl_ok, fl_cancel) == 1;
+ return fl_choice("%s", NULL, fl_ok, fl_cancel, buffer) == 1;
case M_YESNO:
- return fl_choice(buffer, NULL, fl_yes, fl_no) == 1;
+ return fl_choice("%s", NULL, fl_yes, fl_no, buffer) == 1;
case M_OK:
default:
if (((flags & 0xf0) == M_ICONERROR) ||
((flags & 0xf0) == M_ICONWARNING))
- fl_alert(buffer);
+ fl_alert("%s", buffer);
else
- fl_message(buffer);
+ fl_message("%s", buffer);
return true;
}