mirror of
https://github.com/tmux/tmux.git
synced 2024-12-25 02:48:47 +00:00
Allow % strings that are all numbers or %s, and fix a double free. Both
reported by George Nachman, GitHub issues 1765 and 1766.
This commit is contained in:
parent
b26523c26d
commit
82e47403c6
10
cmd-parse.y
10
cmd-parse.y
@ -998,11 +998,15 @@ yylex(void)
|
|||||||
|
|
||||||
if (ch == '%') {
|
if (ch == '%') {
|
||||||
/*
|
/*
|
||||||
* % is a condition unless it is alone, then it is a
|
* % is a condition unless it is all % or all numbers,
|
||||||
* token.
|
* then it is a token.
|
||||||
*/
|
*/
|
||||||
yylval.token = yylex_get_word('%');
|
yylval.token = yylex_get_word('%');
|
||||||
if (strcmp(yylval.token, "%") == 0)
|
for (cp = yylval.token; *cp != '\0'; cp++) {
|
||||||
|
if (*cp != '%' && !isdigit((u_char)*cp))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (*cp == '\0')
|
||||||
return (TOKEN);
|
return (TOKEN);
|
||||||
if (strcmp(yylval.token, "%if") == 0) {
|
if (strcmp(yylval.token, "%if") == 0) {
|
||||||
free(yylval.token);
|
free(yylval.token);
|
||||||
|
@ -91,7 +91,6 @@ control_callback(struct client *c, int closed, __unused void *data)
|
|||||||
case CMD_PARSE_ERROR:
|
case CMD_PARSE_ERROR:
|
||||||
item = cmdq_get_callback(control_error, pr->error);
|
item = cmdq_get_callback(control_error, pr->error);
|
||||||
cmdq_append(c, item);
|
cmdq_append(c, item);
|
||||||
free(pr->error);
|
|
||||||
break;
|
break;
|
||||||
case CMD_PARSE_SUCCESS:
|
case CMD_PARSE_SUCCESS:
|
||||||
item = cmdq_get_command(pr->cmdlist, NULL, NULL, 0);
|
item = cmdq_get_command(pr->cmdlist, NULL, NULL, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user