From c712543ee57f1c76a925a04eba1b8356061d805b Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Mon, 8 Dec 2014 20:17:48 +0000 Subject: [PATCH] Only completeWrite() if we didn't run off the end of the buffer. If we did run off the end, complain about it. --- net_io.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net_io.c b/net_io.c index 1da1dcb..c1b7b53 100644 --- a/net_io.c +++ b/net_io.c @@ -1196,7 +1196,11 @@ static void writeFATSV() { } p += snprintf(p, bufsize(p,end), "\n"); - completeWrite(&Modes.fatsv_out, p); + + if (p <= end) + completeWrite(&Modes.fatsv_out, p); + else + fprintf(stderr, "fatsv: output too large (max %d, overran by %d)\n", TSV_MAX_PACKET_SIZE, (int) (p - end)); # undef bufsize a->fatsv_last_emitted = now;