From: David Levine Date: Sun, 31 Aug 2014 20:39:47 +0000 (-0500) Subject: Fixed read of body in fmttest to limit size to that of rbuf, if X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/b845433f319067da5b7e0ad2f2a479df0b5cea6b?ds=sidebyside;hp=-c Fixed read of body in fmttest to limit size to that of rbuf, if smaller than outwidth, to avoid overrunning it. --- b845433f319067da5b7e0ad2f2a479df0b5cea6b 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); }