Avoid UB in tmux/window_copy_add_formats()
Do not perform NULL pointer arithmetics. Reported with MKSANITIZER/UBSan. The patch proposed by upstream https://github.com/tmux/tmux/issues/1382
This commit is contained in:
parent
54b8bd3463
commit
eb8a7705cd
|
@ -2418,12 +2418,11 @@ void
|
|||
window_copy_add_formats(struct window_pane *wp, struct format_tree *ft)
|
||||
{
|
||||
struct window_copy_mode_data *data = wp->modedata;
|
||||
struct screen *s = &data->screen;
|
||||
|
||||
if (wp->mode != &window_copy_mode)
|
||||
return;
|
||||
|
||||
format_add(ft, "selection_present", "%d", s->sel.flag);
|
||||
format_add(ft, "selection_present", "%d", data->screen.sel.flag);
|
||||
format_add(ft, "scroll_position", "%d", data->oy);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue