mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 04:33:05 +00:00
bugfix issue #368
This commit is contained in:
@@ -677,12 +677,12 @@ encode_object(sproto_callback cb, struct sproto_arg *args, uint8_t *data, int si
|
|||||||
args->value = data+SIZEOF_LENGTH;
|
args->value = data+SIZEOF_LENGTH;
|
||||||
args->length = size-SIZEOF_LENGTH;
|
args->length = size-SIZEOF_LENGTH;
|
||||||
sz = cb(args);
|
sz = cb(args);
|
||||||
assert(sz <= size-SIZEOF_LENGTH); // verify buffer overflow
|
|
||||||
if (sz <= 0)
|
if (sz <= 0)
|
||||||
return sz;
|
return sz;
|
||||||
if (args->type == SPROTO_TSTRING) {
|
if (args->type == SPROTO_TSTRING) {
|
||||||
--sz; // the length of null string is 1
|
--sz; // the length of null string is 1
|
||||||
}
|
}
|
||||||
|
assert(sz <= size-SIZEOF_LENGTH); // verify buffer overflow
|
||||||
return fill_size(data, sz);
|
return fill_size(data, sz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user