diff --git a/lualib-src/sproto/sproto.c b/lualib-src/sproto/sproto.c index 36b209ceb8..75a4c8a42c 100644 --- a/lualib-src/sproto/sproto.c +++ b/lualib-src/sproto/sproto.c @@ -1306,7 +1306,7 @@ sproto_pack(const void * srcv, int srcsz, void * bufferv, int bufsz) { ++ff_n; if (ff_n == 256) { if (bufsz >= 0) { - write_ff(ff_srcstart, ff_desstart, 256*8); + write_ff(ff_srcstart, ff_desstart, srcsz < 256*8 ? srcsz : 256*8); } ff_n = 0; }