aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/termptyesc.c
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2015-08-23 20:57:49 +0200
committerBoris Faure <billiob@gmail.com>2015-08-23 20:57:49 +0200
commit144e0b5068aa25b7fce822a94101586f374aa236 (patch)
tree1fe8fabc2a57990461a3ad544704b57095ef6357 /src/bin/termptyesc.c
parentadd error handlers on textblocks. Should fix T2672 (diff)
downloadterminology-144e0b5068aa25b7fce822a94101586f374aa236.tar.gz
add option to disable terminology escape codes that could be considered
security issues by some They are enabled by default.
Diffstat (limited to 'src/bin/termptyesc.c')
-rw-r--r--src/bin/termptyesc.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index bd525c3..301574a 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -1442,8 +1442,11 @@ _handle_esc_terminology(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *
{
Eina_Unicode *cc;
Eina_Unicode *buf, bufsmall[1024], *b;
- char *s;
- int blen = 0, slen = 0;
+ char *cmd;
+ int blen = 0;
+ Config *config;
+
+ config = termio_config_get(ty->obj);
cc = (Eina_Unicode *)c;
while ((cc < ce) && (*cc != 0x0))
@@ -1469,15 +1472,17 @@ _handle_esc_terminology(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *
return 0;
}
*b = 0;
+
// commands are stored in the buffer, 0 bytes not allowed (end marker)
- s = eina_unicode_unicode_to_utf8(buf, &slen);
- ty->cur_cmd = s;
- if (!_termpty_ext_handle(ty, s, buf))
+ cmd = eina_unicode_unicode_to_utf8(buf, NULL);
+ ty->cur_cmd = cmd;
+ if ((!config->ty_escapes) || (!_termpty_ext_handle(ty, cmd, buf)))
{
if (ty->cb.command.func) ty->cb.command.func(ty->cb.command.data);
}
ty->cur_cmd = NULL;
- free(s);
+ free(cmd);
+
if (buf != bufsmall) free(buf);
return cc - c;
}