File: CVE-2007-1084.dpatch

package info (click to toggle)
kazehakase 0.5.8-4
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 8,184 kB
  • ctags: 7,837
  • sloc: ansic: 64,119; sh: 19,622; cpp: 12,601; ruby: 1,590; makefile: 1,437; xml: 464
file content (35 lines) | stat: -rw-r--r-- 1,178 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#! /bin/sh /usr/share/dpatch/dpatch-run
## CVE-2007-1084.dpatch by Yavor Doganov <yavor@gnu.org>
##
## DP: Do not allow bookmarks with data:/javascript: URIs (CVE-2007-1084).

@DPATCH@
diff -urNad kazehakase-0.5.8~/src/actions/kz-actions.c kazehakase-0.5.8/src/actions/kz-actions.c
--- kazehakase-0.5.8~/src/actions/kz-actions.c	2009-12-07 19:04:58.000000000 +0200
+++ kazehakase-0.5.8/src/actions/kz-actions.c	2009-12-07 19:08:12.000000000 +0200
@@ -1010,6 +1010,25 @@
 
 	if (!uri) return;
 
+	/* Refuse to add a bookmark if the URI is data:/javascript:
+	   (CVE-2007-1084).  */
+	if (g_str_has_prefix(uri, "data:")
+	    || g_str_has_prefix(uri, "javascript:"))
+		{
+			GtkWidget *dialog;
+
+			dialog = gtk_message_dialog_new(NULL,
+							GTK_DIALOG_DESTROY_WITH_PARENT,
+							GTK_MESSAGE_WARNING,
+							GTK_BUTTONS_CLOSE,
+							_("Adding this bookmark is disallowed for security reasons."));
+			gtk_window_set_title(GTK_WINDOW(dialog),
+					     _("Security Warning"));
+			gtk_dialog_run(GTK_DIALOG(dialog));
+			gtk_widget_destroy(dialog);
+			return;
+		}
+
 	bookmark = kz_bookmark_new_with_attrs(title, uri, desc);
 	/* FIXME! show dialog */
 	if (sibling)