[svn-commits] oej: trunk r93161 - /trunk/main/asterisk.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun Dec 16 03:37:41 CST 2007


Author: oej
Date: Sun Dec 16 03:37:41 2007
New Revision: 93161

URL: http://svn.digium.com/view/asterisk?view=rev&rev=93161
Log:
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)

Modified:
    trunk/main/asterisk.c

Modified: trunk/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/trunk/main/asterisk.c?view=diff&rev=93161&r1=93160&r2=93161
==============================================================================
--- trunk/main/asterisk.c (original)
+++ trunk/main/asterisk.c Sun Dec 16 03:37:41 2007
@@ -1771,7 +1771,8 @@
 	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 @@
 			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




More information about the svn-commits mailing list