verify callback overflow

This commit is contained in:
Cloud Wu
2015-10-21 12:58:57 +08:00
parent 2d27df6f46
commit 26cbebfcfd

View File

@@ -677,6 +677,7 @@ encode_object(sproto_callback cb, struct sproto_arg *args, uint8_t *data, int si
args->value = data+SIZEOF_LENGTH;
args->length = size-SIZEOF_LENGTH;
sz = cb(args);
assert(sz <= size-SIZEOF_LENGTH); // verify buffer overflow
if (sz <= 0)
return sz;
if (args->type == SPROTO_TSTRING) {