fix max message length handling - exclude the header
This commit is contained in:
parent
2429653f90
commit
b0755698c1
4 changed files with 4 additions and 4 deletions
|
@ -153,7 +153,7 @@ static bool ubus_validate_hdr(struct ubus_msghdr *hdr)
|
|||
if (blob_raw_len(hdr->data) < sizeof(*hdr->data))
|
||||
return false;
|
||||
|
||||
if (blob_raw_len(hdr->data) + sizeof(*hdr) > UBUS_MAX_MSGLEN)
|
||||
if (blob_pad_len(hdr->data) > UBUS_MAX_MSGLEN)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
|
@ -97,7 +97,7 @@ struct ubus_context {
|
|||
|
||||
struct {
|
||||
struct ubus_msghdr hdr;
|
||||
char data[UBUS_MAX_MSGLEN - sizeof(struct ubus_msghdr)];
|
||||
char data[UBUS_MAX_MSGLEN];
|
||||
} msgbuf;
|
||||
};
|
||||
|
||||
|
|
2
ubusd.c
2
ubusd.c
|
@ -206,7 +206,7 @@ retry:
|
|||
if (cl->pending_msg_offset < sizeof(cl->hdrbuf))
|
||||
goto out;
|
||||
|
||||
if (blob_len(&cl->hdrbuf.data) + sizeof(cl->hdrbuf) > UBUS_MAX_MSGLEN)
|
||||
if (blob_pad_len(&cl->hdrbuf.data) > UBUS_MAX_MSGLEN)
|
||||
goto disconnect;
|
||||
|
||||
cl->pending_msg = ubus_msg_new(NULL, blob_raw_len(&cl->hdrbuf.data), false);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#define __packetdata __attribute__((packed)) __attribute__((__aligned__(4)))
|
||||
|
||||
#define UBUS_MAX_MSGLEN 65535
|
||||
#define UBUS_MAX_MSGLEN 65536
|
||||
|
||||
#define UBUS_SYSTEM_OBJECT_EVENT 1
|
||||
#define UBUS_SYSTEM_OBJECT_MAX 1024
|
||||
|
|
Loading…
Reference in a new issue