Mon 09 Apr 2007 10:43:21 PM UTC, original submission:
There is a format string bug in the function gk_dialog, in gksu.c :
149 diag_win = gtk_message_dialog_new_with_markup (NULL, GTK_DIALOG_MODAL,
150 type, GTK_BUTTONS_CLOSE,
151 msg);
Indeed, the 5th parameter of the call to gtk_message_dialog_new_with_markup is not sanitizied, so a buggy msg can crash gksu.
This bug can be easilly reproduced :
% gksu '%s'
[...] give 3 wrong passwords [...]
zsh: segmentation fault (core dumped)
Here is a trivial patch :
--- gksu.c 2006-09-15 04:45:04.000000000 +0200
+++ gksu.c-patched 2007-04-10 00:40:44.000000000 +0200
@@ -148,7 +148,7 @@
diag_win = gtk_message_dialog_new_with_markup (NULL, GTK_DIALOG_MODAL,
type, GTK_BUTTONS_CLOSE,
- msg);
+ '%s', msg);
gtk_signal_connect_object (GTK_OBJECT(diag_win), "delete_event",
GTK_SIGNAL_FUNC(gtk_main_quit),
|