File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -3063,16 +3063,18 @@ static void handle_wmname(Ghandles * g, struct windowdata *vm_window)
3063
3063
XTextProperty text_prop ;
3064
3064
struct msg_wmname untrusted_msg ;
3065
3065
char buf [sizeof (untrusted_msg .data ) + sizeof (g -> vmname ) + 3 ];
3066
+ size_t name_len ;
3066
3067
char * list [1 ] = { buf };
3067
3068
3068
3069
read_struct (g -> vchan , untrusted_msg );
3069
3070
/* sanitize start */
3070
3071
untrusted_msg .data [sizeof (untrusted_msg .data ) - 1 ] = 0 ;
3071
3072
// If the agent has changed the end of very long title to U+2026 but utf8 is disabled
3073
+ name_len = strlen (untrusted_msg .data );
3072
3074
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 , "..." );
3075
+ && name_len > 3
3076
+ && strcmp (untrusted_msg .data + name_len - 3 , "\xE2\x80\xA6" ) == 0 ) {
3077
+ strcpy (untrusted_msg .data + name_len - 3 , "..." );
3076
3078
}
3077
3079
sanitize_string_from_vm ((unsigned char * ) (untrusted_msg .data ),
3078
3080
g -> allow_utf8_titles );
You can’t perform that action at this time.
0 commit comments