Improve error message for client receive buffer overflow
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>pull/203/head
parent
3e5d6ea8eb
commit
5d443bfa60
|
@ -222,8 +222,13 @@ static json_t* json_from_buffer(struct ctl_client* self)
|
||||||
if (root) {
|
if (root) {
|
||||||
advance_read_buffer(&self->read_buffer, &self->read_len, err.position);
|
advance_read_buffer(&self->read_buffer, &self->read_len, err.position);
|
||||||
} else if (json_error_code(&err) == json_error_premature_end_of_input) {
|
} else if (json_error_code(&err) == json_error_premature_end_of_input) {
|
||||||
DEBUG("Awaiting more data");
|
if (self->read_len == sizeof(self->read_buffer)) {
|
||||||
errno = ENODATA;
|
WARN("Response message is too long");
|
||||||
|
errno = EMSGSIZE;
|
||||||
|
} else {
|
||||||
|
DEBUG("Awaiting more data");
|
||||||
|
errno = ENODATA;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
WARN("Json parsing failed: %s", err.text);
|
WARN("Json parsing failed: %s", err.text);
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
|
|
Loading…
Reference in New Issue