Index: cli.c =================================================================== RCS file: /usr/cvsroot/asterisk/cli.c,v retrieving revision 1.56 diff -u -r1.56 cli.c --- cli.c 8 Oct 2004 18:20:49 -0000 1.56 +++ cli.c 14 Oct 2004 03:17:34 -0000 @@ -441,7 +441,7 @@ int buflen = 2048; int len = 0; char **matches; - int x; + int x, matchlen; if (argc != 4) return RESULT_SHOWUSAGE; @@ -455,8 +455,9 @@ #if 0 printf("command matchesarray for '%s' %s got '%s'\n", argv[2], argv[3], matches[x]); #endif - if (len + strlen(matches[x]) >= buflen) { - buflen += strlen(matches[x]) * 3; + matchlen = strlen(matches[x]) + 1; + if (len + matchlen >= buflen) { + buflen += matchlen * 3; buf = realloc(buf, buflen); } len += sprintf( buf + len, "%s ", matches[x]);