aboutsummaryrefslogtreecommitdiff
path: root/cmd-parse.y
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2019-05-29 13:02:35 +0100
committerThomas Adam <thomas@xteddy.org>2019-05-29 13:02:35 +0100
commite90b5dcea3152272c346d1408f0f0cc1df0f3398 (patch)
tree121f91acc56ad3597d91c0edd775aaf22db9c8e2 /cmd-parse.y
parentffcc60211d3cbdb243b295e624bc9283da54b1d6 (diff)
parenta4424fbebf929f4ad742200365fc330a26a65d7f (diff)
downloadrtmux-e90b5dcea3152272c346d1408f0f0cc1df0f3398.tar.gz
rtmux-e90b5dcea3152272c346d1408f0f0cc1df0f3398.tar.bz2
rtmux-e90b5dcea3152272c346d1408f0f0cc1df0f3398.zip
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-parse.y')
-rw-r--r--cmd-parse.y26
1 files changed, 24 insertions, 2 deletions
diff --git a/cmd-parse.y b/cmd-parse.y
index f347280b..739ca56c 100644
--- a/cmd-parse.y
+++ b/cmd-parse.y
@@ -1083,12 +1083,34 @@ error:
static int
yylex_token_escape(char **buf, size_t *len)
{
- int ch, type;
+ int ch, type, o2, o3;
u_int size, i, tmp;
char s[9];
struct utf8_data ud;
- switch (ch = yylex_getc()) {
+ ch = yylex_getc();
+
+ if (ch >= '4' && ch <= '7') {
+ yyerror("invalid octal escape");
+ return (0);
+ }
+ if (ch >= '0' && ch <= '3') {
+ o2 = yylex_getc();
+ if (o2 >= '0' && o2 <= '7') {
+ o3 = yylex_getc();
+ if (o3 >= '0' && o3 <= '7') {
+ ch = 64 * (ch - '0') +
+ 8 * (o2 - '0') +
+ (o3 - '0');
+ yylex_append1(buf, len, ch);
+ return (1);
+ }
+ }
+ yyerror("invalid octal escape");
+ return (0);
+ }
+
+ switch (ch) {
case EOF:
return (0);
case 'e':