Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the end of very long window titles to ... #155

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions gui-daemon/xside.c
Original file line number Diff line number Diff line change
Expand Up @@ -2912,6 +2912,12 @@ static void handle_wmname(Ghandles * g, struct windowdata *vm_window)
read_struct(g->vchan, untrusted_msg);
/* sanitize start */
untrusted_msg.data[sizeof(untrusted_msg.data) - 1] = 0;
/* change the end of very long window titles to ... */
if (strlen(untrusted_msg.data) == (sizeof(untrusted_msg.data) - 1)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be done on the agent side instead? It knows where the limit is too, and may have more info (especially, if it really was truncated or maybe just at the limit).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be done on the agent side instead? It knows where the limit is too, and may have more info (especially, if it really was truncated or maybe just at the limit).

I did it on the agent side at the beginning. I am going to change this PR to draft and do it properly, writing the main patch for both agent and xside to have the length increased (from 128 to 4096) as well as appending ... if necessary.

untrusted_msg.data[sizeof(untrusted_msg.data) - 2] = '.';
untrusted_msg.data[sizeof(untrusted_msg.data) - 3] = '.';
untrusted_msg.data[sizeof(untrusted_msg.data) - 4] = '.';
}
sanitize_string_from_vm((unsigned char *) (untrusted_msg.data),
g->allow_utf8_titles);
if (g->prefix_titles)
Expand Down