=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mg/echo.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- src/usr.bin/mg/echo.c 2001/05/24 09:47:33 1.16 +++ src/usr.bin/mg/echo.c 2002/01/18 08:37:08 1.17 @@ -1,4 +1,4 @@ -/* $OpenBSD: echo.c,v 1.16 2001/05/24 09:47:33 art Exp $ */ +/* $OpenBSD: echo.c,v 1.17 2002/01/18 08:37:08 art Exp $ */ /* * Echo line reading and writing. @@ -417,7 +417,7 @@ int oldrow = ttrow; int oldcol = ttcol; int oldhue = tthue; - char linebuf[NCOL + 1]; + char *linebuf; char *cp; lh = NULL; @@ -504,6 +504,8 @@ * Now do the display. objects are written into linebuf until * it fills, and then put into the help buffer. */ + if ((linebuf = malloc((nrow + 1) * sizeof(char))) == NULL) + return FALSE; cp = linebuf; width = 0; lh2 = lh; @@ -532,6 +534,7 @@ *cp = 0; addline(bp, linebuf); } + free(linebuf); } /* * Note that we free lists only if they are put in wholelist lists