Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wudeng committed Jun 19, 2020
1 parent 2d5080b commit 6f763fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lualib-src/sproto/sproto.c
Original file line number Diff line number Diff line change
Expand Up @@ -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<srcsz;i+=8) {
int n;
Expand Down Expand Up @@ -1323,7 +1323,7 @@ sproto_pack(const void * srcv, int srcsz, void * bufferv, int bufsz) {
buffer += n;
size += n;
}
if(bufsz >= 0) {
if(bufsz >= 0 && ff_n > 0) {
write_ff(ff_srcstart, src_end, ff_desstart, ff_n);
}
return size;
Expand Down

0 comments on commit 6f763fe

Please sign in to comment.