mirror of
https://github.com/tmux/tmux.git
synced 2026-10-06 17:49:52 +00:00
Merge remote-tracking branch 'refs/remotes/tmux-openbsd/master'
* refs/remotes/tmux-openbsd/master: Do not pass NULL to qsort, and add checks for invalid session or window after swap.
This commit is contained in:
4
sort.c
4
sort.c
@@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: sort.c,v 1.9 2026/06/29 07:45:09 nicm Exp $ */
|
/* $OpenBSD: sort.c,v 1.10 2026/08/25 07:23:30 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2026 Dane Jensen <dhcjensen@gmail.com>
|
* Copyright (c) 2026 Dane Jensen <dhcjensen@gmail.com>
|
||||||
@@ -32,7 +32,7 @@ sort_qsort(void *l, u_int len, u_int size, int (*cmp)(const void *,
|
|||||||
u_int i;
|
u_int i;
|
||||||
void *tmp, **ll;
|
void *tmp, **ll;
|
||||||
|
|
||||||
if (sort_crit->order == SORT_END)
|
if (len < 2 || sort_crit->order == SORT_END)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (sort_crit->order == SORT_ORDER) {
|
if (sort_crit->order == SORT_ORDER) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: window-switch.c,v 1.2 2026/07/14 17:17:18 nicm Exp $ */
|
/* $OpenBSD: window-switch.c,v 1.3 2026/08/25 07:23:30 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2026 Nicholas Marriott <nicholas.marriott@gmail.com>
|
* Copyright (c) 2026 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||||
@@ -227,7 +227,8 @@ window_switch_build(struct window_switch_modedata *data)
|
|||||||
m = xreallocarray(m, n + 1, sizeof *m);
|
m = xreallocarray(m, n + 1, sizeof *m);
|
||||||
m[n++] = item;
|
m[n++] = item;
|
||||||
}
|
}
|
||||||
qsort(m, n, sizeof *m, window_switch_compare);
|
if (n > 1)
|
||||||
|
qsort(m, n, sizeof *m, window_switch_compare);
|
||||||
|
|
||||||
free(data->matches);
|
free(data->matches);
|
||||||
data->matches = m;
|
data->matches = m;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: window-tree.c,v 1.95 2026/08/24 07:06:58 nicm Exp $ */
|
/* $OpenBSD: window-tree.c,v 1.96 2026/08/25 07:23:30 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com>
|
* Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||||
@@ -1022,6 +1022,10 @@ window_tree_swap(void *cur_itemdata, void *other_itemdata,
|
|||||||
window_tree_pull_item(other, &other_session, &other_winlink,
|
window_tree_pull_item(other, &other_session, &other_winlink,
|
||||||
&other_pane);
|
&other_pane);
|
||||||
|
|
||||||
|
if (cur_session == NULL || cur_winlink == NULL)
|
||||||
|
return (0);
|
||||||
|
if (other_session == NULL || other_winlink == NULL)
|
||||||
|
return (0);
|
||||||
if (cur_session != other_session)
|
if (cur_session != other_session)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user