File: cookie-not-zero.patch

package info (click to toggle)
xssproxy 1.0.0-1%2Bdeb13u1
  • links: PTS
  • area: main
  • in suites: trixie
  • size: 168 kB
  • sloc: ansic: 272; makefile: 24
file content (38 lines) | stat: -rw-r--r-- 1,081 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
36
37
38
From: Nicolas Schodet <nico@ni.fr.eu.org>
Last-Update: 2025-09-27
Subject: Do not use cookie with a zero value

Bug: https://github.com/vincentbernat/xssproxy/pull/10
Bug-Debian: https://bugs.debian.org/1115458
Applied-Upstream: 1.1.2

This causes problems at least for xdg-desktop-portal-gtk, see
https://github.com/flatpak/xdg-desktop-portal-gtk/issues/528.

Avoid the problem by not using zero value.
---
 xssproxy.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/xssproxy.c b/xssproxy.c
index 62966ed..cceb068 100644
--- a/xssproxy.c
+++ b/xssproxy.c
@@ -145,13 +145,14 @@ uint32_t inhibit_request(const char *app)
     int i;
     for (i=0; i<cookies->len; i++)
     {
-        if (i != g_array_index(cookies, uint32_t, i))
+        if (i + 1 != g_array_index(cookies, uint32_t, i))
         {
             break;
         }
     }
-    g_array_insert_val(cookies, i, i);
-    return i;
+    uint32_t cookie = i + 1;
+    g_array_insert_val(cookies, i, cookie);
+    return cookie;
 }
 
 void handle_inhibit(DBusConnection *conn, DBusMessage *msg)