From b845433f319067da5b7e0ad2f2a479df0b5cea6b Mon Sep 17 00:00:00 2001 From: David Levine Date: Sun, 31 Aug 2014 15:39:47 -0500 Subject: [PATCH] Fixed read of body in fmttest to limit size to that of rbuf, if smaller than outwidth, to avoid overrunning it. --- uip/fmttest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uip/fmttest.c b/uip/fmttest.c index ad9dcef0..1a3f633e 100644 --- a/uip/fmttest.c +++ b/uip/fmttest.c @@ -649,7 +649,7 @@ process_single_file(FILE *in, struct msgs_array *comps, int *dat, int msgsize, case BODY: if (fmt_findcomp("body")) { if ((i = strlen(rbuf)) < outwidth) { - bufsz = outwidth - 1; + bufsz = min (outwidth, (int) sizeof rbuf - i); state = m_getfld(&gstate, name, rbuf + i, &bufsz, in); } -- 2.56.0