Skip to content

Commit a993c9d

Browse files
committed
Replace U+2026 with ... if utf8 is disabled
Agent side should have replaced the end of very long window titles to U+2026 (Horizontal Ellipsis). But the Daemon side might have been configured to disallow UTF8 characters. Replace that character with ... Supplements: QubesOS/qubes-gui-agent-linux#227 Main issue: QubesOS/qubes-issues#5986
1 parent cd00839 commit a993c9d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

gui-daemon/xside.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3068,8 +3068,15 @@ static void handle_wmname(Ghandles * g, struct windowdata *vm_window)
30683068
read_struct(g->vchan, untrusted_msg);
30693069
/* sanitize start */
30703070
untrusted_msg.data[sizeof(untrusted_msg.data) - 1] = 0;
3071+
// If the agent has changed the end of very long title to U+2026 but utf8 is disabled
3072+
if (!g->allow_utf8_titles
3073+
&& strlen(untrusted_msg.data) > 3
3074+
&& strcmp(untrusted_msg.data + strlen(untrusted_msg.data) - 3, "\xE2\x80\xA6") == 0) {
3075+
strcpy(untrusted_msg.data + strlen(untrusted_msg.data) - 3, "...");
3076+
}
30713077
sanitize_string_from_vm((unsigned char *) (untrusted_msg.data),
30723078
g->allow_utf8_titles);
3079+
30733080
if (g->prefix_titles)
30743081
snprintf(buf, sizeof(buf), "[%s] %s", g->vmname, untrusted_msg.data);
30753082
else

0 commit comments

Comments
 (0)