From 105395ab9b3fb60628ff27062b6ce3f1f968021f Mon Sep 17 00:00:00 2001 From: David Levine Date: Mon, 1 Sep 2014 20:14:52 -0500 Subject: [PATCH] Don't let scan() use too large a width (BUFSIZ for now) to prevent allocating a huge output buffer. --- uip/scansbr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uip/scansbr.c b/uip/scansbr.c index 2111bc16..3c6b771d 100644 --- a/uip/scansbr.c +++ b/uip/scansbr.c @@ -134,7 +134,7 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, if (used_buf == NULL) adios (NULL, "unable to allocate component buffer stack"); used_buf += ncomps+1; *--used_buf = 0; - rlwidth = bodycomp && (width > SBUFSIZ) ? width : SBUFSIZ; + rlwidth = bodycomp && (width > SBUFSIZ) ? min (width, BUFSIZ) : SBUFSIZ; for (i = ncomps; i--; ) *nxtbuf++ = mh_xmalloc(rlwidth); } -- 2.56.0