diff --git a/lualib-src/sproto/sproto.c b/lualib-src/sproto/sproto.c index 6864cf8d9..2c36ad9f2 100644 --- a/lualib-src/sproto/sproto.c +++ b/lualib-src/sproto/sproto.c @@ -1283,7 +1283,7 @@ sproto_pack(const void * srcv, int srcsz, void * bufferv, int bufsz) { int ff_n = 0; int size = 0; const uint8_t * src = srcv; - const uint8_t * src_end = srcv + srcsz; + const uint8_t * src_end = (uint8_t *)srcv + srcsz; uint8_t * buffer = bufferv; for (i=0;i= 0) { + if(bufsz >= 0 && ff_n > 0) { write_ff(ff_srcstart, src_end, ff_desstart, ff_n); } return size;