diff options
author | Kevin P. Fleming <kpfleming@digium.com> | 2006-11-15 00:19:35 +0000 |
---|---|---|
committer | Kevin P. Fleming <kpfleming@digium.com> | 2006-11-15 00:19:35 +0000 |
commit | f04ac0ad7ed27f1aa25e47bc07a82b365b5260b4 (patch) | |
tree | 3ff3a10cf419f11c7d4b7560cc545d30b3d881dc /main/term.c | |
parent | 5861048fb62a6ef78a86d0ec3e79c5ba53a98f87 (diff) |
Merged revisions 47641 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r47641 | kpfleming | 2006-11-14 18:19:05 -0600 (Tue, 14 Nov 2006) | 2 lines
more formatting cleanup, and avoid running off the end of the string
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47642 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/term.c')
-rw-r--r-- | main/term.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/main/term.c b/main/term.c index bdafa49e2..940396ee3 100644 --- a/main/term.c +++ b/main/term.c @@ -266,28 +266,26 @@ char *term_prompt(char *outbuf, const char *inbuf, int maxout) /* filter escape sequences */ void term_filter_escapes(char *line) - { - int i; - - for (i = 0; i < strlen(line); i++) { +{ + int i; + int len = strlen(line); + + for (i = 0; i < len; i++) { if (line[i] != ESC) continue; - if (line[i + 1] == '\x5b') { + if ((i < (len - 2)) && + (line[i + 1] == 0x5B)) { switch (line[i + 2]) { - case '\x30': - case '\x31': - case '\x33': - break; - default: - /* replace ESC with a space */ - line[i] = ' '; + case 0x30: + case 0x31: + case 0x33: + continue; } - } else { - /* replace ESC with a space */ - line[i] = ' '; } - } - } + /* replace ESC with a space */ + line[i] = ' '; + } +} char *term_prep(void) { |