mirror of
https://github.com/tmux/tmux.git
synced 2026-04-15 19:46:27 +00:00
Merge branch 'obsd-master'
This commit is contained in:
2
cmd.c
2
cmd.c
@@ -303,6 +303,8 @@ cmd_unpack_argv(char *buf, size_t len, int argc, char ***argv)
|
|||||||
|
|
||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
return (0);
|
return (0);
|
||||||
|
if (argc < 0 || argc > 1000)
|
||||||
|
return (-1);
|
||||||
*argv = xcalloc(argc, sizeof **argv);
|
*argv = xcalloc(argc, sizeof **argv);
|
||||||
|
|
||||||
buf[len - 1] = '\0';
|
buf[len - 1] = '\0';
|
||||||
|
|||||||
@@ -1116,7 +1116,7 @@ format_width(const char *expanded)
|
|||||||
/*
|
/*
|
||||||
* Trim on the left, taking #[] into account. Note, we copy the whole set of
|
* Trim on the left, taking #[] into account. Note, we copy the whole set of
|
||||||
* unescaped #s, but only add their escaped size to width. This is because the
|
* unescaped #s, but only add their escaped size to width. This is because the
|
||||||
* format_draw function will actually do the escaping when it runs
|
* format_draw function will actually do the escaping.
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
format_trim_left(const char *expanded, u_int limit)
|
format_trim_left(const char *expanded, u_int limit)
|
||||||
|
|||||||
16
format.c
16
format.c
@@ -4207,6 +4207,8 @@ format_build_modifiers(struct format_expand_state *es, const char **s,
|
|||||||
/* Skip any separator character. */
|
/* Skip any separator character. */
|
||||||
if (*cp == ';')
|
if (*cp == ';')
|
||||||
cp++;
|
cp++;
|
||||||
|
if (*cp == '\0')
|
||||||
|
break;
|
||||||
|
|
||||||
/* Check single character modifiers with no arguments. */
|
/* Check single character modifiers with no arguments. */
|
||||||
if (strchr("labcdnwETSWPL!<>", cp[0]) != NULL &&
|
if (strchr("labcdnwETSWPL!<>", cp[0]) != NULL &&
|
||||||
@@ -4767,7 +4769,7 @@ format_replace_expression(struct format_modifier *mexp,
|
|||||||
|
|
||||||
/* The third argument may be precision. */
|
/* The third argument may be precision. */
|
||||||
if (argc >= 3) {
|
if (argc >= 3) {
|
||||||
prec = strtonum(mexp->argv[2], INT_MIN, INT_MAX, &errstr);
|
prec = strtonum(mexp->argv[2], INT_MIN + 1, INT_MAX, &errstr);
|
||||||
if (errstr != NULL) {
|
if (errstr != NULL) {
|
||||||
format_log(es, "expression precision %s: %s", errstr,
|
format_log(es, "expression precision %s: %s", errstr,
|
||||||
mexp->argv[2]);
|
mexp->argv[2]);
|
||||||
@@ -4912,8 +4914,8 @@ format_replace(struct format_expand_state *es, const char *key, size_t keylen,
|
|||||||
case '=':
|
case '=':
|
||||||
if (fm->argc < 1)
|
if (fm->argc < 1)
|
||||||
break;
|
break;
|
||||||
limit = strtonum(fm->argv[0], INT_MIN, INT_MAX,
|
limit = strtonum(fm->argv[0], INT_MIN + 1,
|
||||||
&errstr);
|
INT_MAX, &errstr);
|
||||||
if (errstr != NULL)
|
if (errstr != NULL)
|
||||||
limit = 0;
|
limit = 0;
|
||||||
if (fm->argc >= 2 && fm->argv[1] != NULL)
|
if (fm->argc >= 2 && fm->argv[1] != NULL)
|
||||||
@@ -4922,8 +4924,8 @@ format_replace(struct format_expand_state *es, const char *key, size_t keylen,
|
|||||||
case 'p':
|
case 'p':
|
||||||
if (fm->argc < 1)
|
if (fm->argc < 1)
|
||||||
break;
|
break;
|
||||||
width = strtonum(fm->argv[0], INT_MIN, INT_MAX,
|
width = strtonum(fm->argv[0], INT_MIN + 1,
|
||||||
&errstr);
|
INT_MAX, &errstr);
|
||||||
if (errstr != NULL)
|
if (errstr != NULL)
|
||||||
width = 0;
|
width = 0;
|
||||||
break;
|
break;
|
||||||
@@ -5341,6 +5343,7 @@ done:
|
|||||||
if (marker != NULL && strcmp(new, value) != 0) {
|
if (marker != NULL && strcmp(new, value) != 0) {
|
||||||
free(value);
|
free(value);
|
||||||
xasprintf(&value, "%s%s", new, marker);
|
xasprintf(&value, "%s%s", new, marker);
|
||||||
|
free(new);
|
||||||
} else {
|
} else {
|
||||||
free(value);
|
free(value);
|
||||||
value = new;
|
value = new;
|
||||||
@@ -5351,6 +5354,7 @@ done:
|
|||||||
if (marker != NULL && strcmp(new, value) != 0) {
|
if (marker != NULL && strcmp(new, value) != 0) {
|
||||||
free(value);
|
free(value);
|
||||||
xasprintf(&value, "%s%s", marker, new);
|
xasprintf(&value, "%s%s", marker, new);
|
||||||
|
free(new);
|
||||||
} else {
|
} else {
|
||||||
free(value);
|
free(value);
|
||||||
value = new;
|
value = new;
|
||||||
@@ -5463,7 +5467,7 @@ format_expand1(struct format_expand_state *es, const char *fmt)
|
|||||||
buf[off++] = *fmt++;
|
buf[off++] = *fmt++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (*fmt++ == '\0')
|
if (*++fmt == '\0')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
ch = (u_char)*fmt++;
|
ch = (u_char)*fmt++;
|
||||||
|
|||||||
2
regsub.c
2
regsub.c
@@ -68,6 +68,8 @@ regsub(const char *pattern, const char *with, const char *text, int flags)
|
|||||||
|
|
||||||
if (*text == '\0')
|
if (*text == '\0')
|
||||||
return (xstrdup(""));
|
return (xstrdup(""));
|
||||||
|
if (*pattern == '\0')
|
||||||
|
return (xstrdup(text));
|
||||||
if (regcomp(&r, pattern, flags) != 0)
|
if (regcomp(&r, pattern, flags) != 0)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
|
|||||||
1
sort.c
1
sort.c
@@ -505,6 +505,7 @@ sort_get_panes_session(struct session *s, u_int *n,
|
|||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
RB_FOREACH(wl, winlinks, &s->windows) {
|
RB_FOREACH(wl, winlinks, &s->windows) {
|
||||||
|
w = wl->window;
|
||||||
TAILQ_FOREACH(wp, &w->panes, entry) {
|
TAILQ_FOREACH(wp, &w->panes, entry) {
|
||||||
if (lsz <= i) {
|
if (lsz <= i) {
|
||||||
lsz += 100;
|
lsz += 100;
|
||||||
|
|||||||
@@ -3333,7 +3333,7 @@ window_copy_command(struct window_mode_entry *wme, struct client *c,
|
|||||||
enum window_copy_cmd_clear clear = WINDOW_COPY_CMD_CLEAR_NEVER;
|
enum window_copy_cmd_clear clear = WINDOW_COPY_CMD_CLEAR_NEVER;
|
||||||
const char *command;
|
const char *command;
|
||||||
u_int i, count = args_count(args);
|
u_int i, count = args_count(args);
|
||||||
int keys;
|
int keys, flags;
|
||||||
char *error = NULL;
|
char *error = NULL;
|
||||||
|
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
@@ -3355,9 +3355,10 @@ window_copy_command(struct window_mode_entry *wme, struct client *c,
|
|||||||
action = WINDOW_COPY_CMD_NOTHING;
|
action = WINDOW_COPY_CMD_NOTHING;
|
||||||
for (i = 0; i < nitems(window_copy_cmd_table); i++) {
|
for (i = 0; i < nitems(window_copy_cmd_table); i++) {
|
||||||
if (strcmp(window_copy_cmd_table[i].command, command) == 0) {
|
if (strcmp(window_copy_cmd_table[i].command, command) == 0) {
|
||||||
if (c->flags & CLIENT_READONLY &&
|
flags = window_copy_cmd_table[i].flags;
|
||||||
(~window_copy_cmd_table[i].flags &
|
if (c != NULL &&
|
||||||
WINDOW_COPY_CMD_FLAG_READONLY)) {
|
c->flags & CLIENT_READONLY &&
|
||||||
|
(~flags & WINDOW_COPY_CMD_FLAG_READONLY)) {
|
||||||
status_message_set(c, -1, 1, 0, 0,
|
status_message_set(c, -1, 1, 0, 0,
|
||||||
"client is read-only");
|
"client is read-only");
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user