mirror of
https://github.com/mpv-player/mpv
synced 2025-03-30 07:18:17 +00:00
wayland, x11: fix possibly unsafe bstr usage
In practice this never led to any issues due to implementation details of bstr_sanitize_utf8_latin1, but there's no guarantee that a bstr is correctly null-terminated.
This commit is contained in:
parent
2e5d0d6e07
commit
175e250038
@ -1684,7 +1684,7 @@ static int update_window_title(struct vo_wayland_state *wl, const char *title)
|
||||
/* The xdg-shell protocol requires that the title is UTF-8. */
|
||||
void *tmp = talloc_new(NULL);
|
||||
struct bstr b_title = bstr_sanitize_utf8_latin1(tmp, bstr0(title));
|
||||
xdg_toplevel_set_title(wl->xdg_toplevel, b_title.start);
|
||||
xdg_toplevel_set_title(wl->xdg_toplevel, bstrto0(tmp, b_title));
|
||||
talloc_free(tmp);
|
||||
return VO_TRUE;
|
||||
}
|
||||
|
@ -1439,8 +1439,8 @@ static void vo_x11_update_window_title(struct vo *vo)
|
||||
/* _NET_WM_NAME and _NET_WM_ICON_NAME must be sanitized to UTF-8. */
|
||||
void *tmp = talloc_new(NULL);
|
||||
struct bstr b_title = bstr_sanitize_utf8_latin1(tmp, bstr0(x11->window_title));
|
||||
vo_x11_set_property_utf8(vo, XA(x11, _NET_WM_NAME), b_title.start);
|
||||
vo_x11_set_property_utf8(vo, XA(x11, _NET_WM_ICON_NAME), b_title.start);
|
||||
vo_x11_set_property_utf8(vo, XA(x11, _NET_WM_NAME), bstrto0(tmp, b_title));
|
||||
vo_x11_set_property_utf8(vo, XA(x11, _NET_WM_ICON_NAME), bstrto0(tmp, b_title));
|
||||
talloc_free(tmp);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user