aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2014-09-15 23:10:55 +0200
committerBoris Faure <billiob@gmail.com>2014-09-15 23:10:55 +0200
commitcaed00cc1fa0f41057381886f7ce474cc38e42d8 (patch)
tree0f63fd89388c58f242f99691392923bf367955b7 /src
parentfix segfault when OOM on the termpty_save module (diff)
downloadterminology-caed00cc1fa0f41057381886f7ce474cc38e42d8.tar.gz
fix segfault due to using isdigit with non unsigned char value. Closes https://phab.enlightenment.org/T1625
Also rename _termpty_handle_seq() to termpty_handle_seq() since it's not static.
Diffstat (limited to 'src')
-rw-r--r--src/bin/termptyesc.c9
-rw-r--r--src/bin/termptyesc.h2
2 files changed, 6 insertions, 5 deletions
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index 2557e0f..b242011 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -36,13 +36,13 @@ _csi_arg_get(Eina_Unicode **ptr)
Eina_Unicode *b = *ptr;
int sum = 0;
- while ((*b) && (!isdigit(*b))) b++;
+ while ((*b) && (*b < '0' || *b > '9')) b++;
if (!*b)
{
*ptr = NULL;
return 0;
}
- while (isdigit(*b))
+ while ((*b >= '0') && (*b <= '9'))
{
sum *= 10;
sum += *b - '0';
@@ -1050,7 +1050,7 @@ _xterm_arg_get(Eina_Unicode **ptr)
Eina_Unicode *b = *ptr;
int sum = 0;
- while (*b && isdigit(*b))
+ while (*b >= '0' && *b <= '9')
{
sum *= 10;
sum += *b - '0';
@@ -1598,8 +1598,9 @@ _handle_esc(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
return 0;
}
+/* XXX: ce is excluded */
int
-_termpty_handle_seq(Termpty *ty, Eina_Unicode *c, Eina_Unicode *ce)
+termpty_handle_seq(Termpty *ty, Eina_Unicode *c, Eina_Unicode *ce)
{
Eina_Unicode *cc;
int len = 0;
diff --git a/src/bin/termptyesc.h b/src/bin/termptyesc.h
index 982fc6a..9579673 100644
--- a/src/bin/termptyesc.h
+++ b/src/bin/termptyesc.h
@@ -1,6 +1,6 @@
#ifndef _TERMPTY_ESC_H__
#define _TERMPTY_ESC_H__ 1
-int _termpty_handle_seq(Termpty *ty, Eina_Unicode *c, Eina_Unicode *ce);
+int termpty_handle_seq(Termpty *ty, Eina_Unicode *c, Eina_Unicode *ce);
#endif