aboutsummaryrefslogtreecommitdiffstats
path: root/main/asterisk.c
diff options
context:
space:
mode:
authoroej <oej@f38db490-d61c-443f-a65b-d21fe96a405b>2007-12-16 09:37:41 +0000
committeroej <oej@f38db490-d61c-443f-a65b-d21fe96a405b>2007-12-16 09:37:41 +0000
commite25fbbfbd93812d1a2a6f11c86450202559f0907 (patch)
tree1a9f99c2869f1a4adb3b9fb68a594b8e72a53314 /main/asterisk.c
parentce6fe83f1ccfe3979d3a280f05f725818960eaec (diff)
Don't drop the first character randomly in long listings in the CLI.
Reported by: slavon Patches: asterisk-consolerefresh2.diff.txt uploaded by jamesgolovich (license 176) Tested by: eliel (closes issue #9325) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@93161 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/asterisk.c')
-rw-r--r--main/asterisk.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/main/asterisk.c b/main/asterisk.c
index 67dc361d0..dbc44387d 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -1771,7 +1771,8 @@ static int ast_el_read_char(EditLine *el, char *cp)
struct pollfd fds[2];
int res;
int max;
- char buf[512];
+#define EL_BUF_SIZE 512
+ char buf[EL_BUF_SIZE];
for (;;) {
max = 1;
@@ -1833,7 +1834,7 @@ static int ast_el_read_char(EditLine *el, char *cp)
if (!ast_opt_exec && !lastpos)
write(STDOUT_FILENO, "\r", 1);
write(STDOUT_FILENO, buf, res);
- if ((buf[res-1] == '\n') || (buf[res-2] == '\n')) {
+ if ((res < EL_BUF_SIZE - 1) && ((buf[res-1] == '\n') || (buf[res-2] == '\n'))) {
*cp = CC_REFRESH;
return(1);
} else